Exercise 1: DDL Commands: SP - Help
Exercise 1: DDL Commands: SP - Help
DDL Commands
1. Create a table employee (ename(30 chars), eid, edesignation(20 chars), ecity)
Perform the following queries
1.Describe the fields of the table. (hint: use sp_help command)
--create table employee(ename varchar(30), eid int, edesgn varchar(10), ecity
varchar(10));
sp_help employee;
2.Add a new field named salary to the table and it must contain some values.
--create table employee(ename varchar(30), eid int, edesgn varchar(10), ecity
varchar(10));
--sp_help employee;
--alter table employee add salary float;
select*from employee;
8.Delete all employee record from the table. (hint: use delete/truncate command)
--truncate table employee2;
select * from employee2;
9.Drop the table.
--sp_rename employee3,employei;
--drop table employei;
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