Termworkdbms

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

DBMS Term work

Experiment-1. Create the table student and branch as following.

Experiment-2. Delete students from table where their ages are between 19 and 20 years.

Experiment-3. Apply DROP and TRUNCATE command on table student and show the results.

Experiment-4. Update the student name as Vishal where age is greater than 20 years.

Experiment-5. Select those students where their name ending with alphabet ‘a’.

Experiment-6. Print the name of those students where string ‘na’ appears in their name.

Experiment-7. Apply following Constraints on the above tables.

a> Roll no Should be Not Null.

b>Roll no Should be primary key in student table and Branch_id should be primary key in table branch.

c>Make Branch_id as a foreign key in table Branch which refers table student.

d> Apply Check constraint with condition age>=18.

Experiment-8. Use Alter command to add,delete and modify columns on table Student and show the results.

Experiment-9. Apply INNER JOIN and FULL JOIN on above both tables.

Experiment-10. Apply NATURAL JOIN on above both tables.

Experiment-11. Apply OUTER JOIN and all its types on above both tables.

Experiment-12. Sort the Table Student in ascending order on the basis of age and for same age branch_id should be in
descending order.

Experiment-13. Apply IN, ANY and ALL operators for above tables and show the results.(Sub queries)

Experiment-14.Apply Aggregate functions as given below.

a> Find the sum of column age in table student.

b> Find the Maximum age in table student.

c> Find the Minimum age in table student.

d> Find the Average age in table student.

e> Count number of students where age is between 18 and 20.

Experiment-15. Apply group by statement on attribute Branch_id in table student and apply a condition(with having
clause) that age>18.
Experiment-16. Create a VIEW from table student and select only Roll_no and name attributes with condition age>=19.

Experiment-17.

Table-1

Table-2

Create these two tables and insert values as mentioned above.

Then apply all Set operations in these two tables i.e

a> UNION (On attribute Country)

b>UNION ALL (On attribute EmpId)

c>INTERSECT (On attribute Country)

d>MINUS (On attribute Mob)


SOME SQL QUESTIONS (From above tables i.e student and branch)
Q-1 Name of students Where their HOD name is Mr.abc

Q-2 Name of students of EC Branch.

Q-3 Find the roll no’s of EX Branch Students.

Q-4 Find the age of those students where their name start with alphabet ‘a’.

Q-5 Calculate Sum of Roll no and age from table student.

Q-6 Count number of students in CSE branch.

Q-7 Which student(s) is eldest.

Q-8 Which student(s) is youngest.

Q-9 Find the Roll no and name of those students where their HOD name is either Mr.abc or Dr.xyz.

Q-10 Find HOD name of student Analisa.

You might also like