Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

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>

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

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.

1. Left outer join


2. Right outer join
3. Full join
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)

1.IN
2.ANY
3.ALL
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.
Table1-
Table2-
a) UNION (On attribute Country)
select Country from Table1 union select Country from Table2;

b) UNION ALL (On attribute EmpId)


select EmpID from Table1 union all select EmpID from Table2;

c) INTERSECT (On attribute Country)


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