Exercise-1 1
Exercise-1 1
Exercise-1 1
DDL Commands
1. Create a table employee (ename(30 chars), eid, edesignation(20 chars), ecity)
Perform the following queries
a) Describe the fields of the table. (hint: use sp_help command)
b) Add a new field named salary to the table and it must contain some values.
c) Modify the field edesignation so that it can accept upto 30 characters.
d) Insert 10 employee records.
e) Display the employee details.
f) Drop a column salary.
g) Rename the table. (hint: command sp_rename)
h) Delete all employee record from the table. (hint: use delete/truncate command)
i) Drop the table.
DML Commands
1. Create the following tables
Student (Rollno, Name, Deptname, Marks (of 4 Subjects), Total, Percentage.
Insert 10 student details.
a) Display the Student details.
b) Display the student names who got total greater than 300
c) Display the CSE department student names.
d) Display the student detail whose department is “it” and also percentage is greater than
or equal to 75.
e) Find the student details whose department is in Civil, Mech.
f) Select regno, name, grade, department, percentage of all students
g) Sort the student name in ascending order and descending order.
h) Drop the column rollno.
Additional Exercises
Exercise 1.2:
1. Create a table Student (Rollno, Name, Deptname, Marks (of 4 Subjects), Total, Percentage.
Insert 10 student details
Perform the following queries
j) Insert 10 employee records.
k) Display the department of all students without duplicates.
l) Select regno, name, grade, department, percentage of all students except those who
doesn’t have percentage in 75, 80 and 85.
m) Select the students who have percentage in the range between 70 and 90.
n) List out the departments with no of students present in the student table.