Term Work: Database Management System
Term Work: Database Management System
on
Gehu D.DUN
Rana Sir for his patience, support and encouragement throughout the
At last but not the least I greatly indebted to all other persons who
Dev Arora
33. Disconnect
PROGRAM – 2
Drop the columns “name” and “empcode” from NewEmp table. 30. See the records of
NewEmp Table.
Truncate the “Mytable” table. (do not use delete command)
See the records of “MyTable” table
Rollback
Again See the records of “MyTable” table. (What is your observation?)
Drop the “MyTable” table
See the records of “MyTable” table
Rollback
Again See the records of “MyTable” table. (What is your observation?)
PROGRAM-3
7.Show the list of all cities (names of cities should not be repeated)
8.Show the names students alphabetically in ascending order.
9.Show the records of those students which are either less than 20 year or they are living in
Bombay
10.Display those records which do not have pin code
17. Create a new table “student2” as a copy of Students with all rows from Students table
PROGRAM-4
<1>
<2>
<4>
SQL> select ltrim(' hai') from dual;
<5>
SQL> select rtrim('hai ') from dual;
<6>
SQL> select rtrim(' hai ') from dual;
<7>
SQL> select concat('GEHU',' university') from dual;
<8>
SQL> select length('GEHU’) from dual;
<9>
SQL> select replace('GEHU university', 'GEHU','GEU') from dual;
<10>
SQL> select substr('UNIVERSITY', 4,6) from dual;
<11>
SQL> select rpad('GEHU',10,'*')from dual;
<12>
SQL> select lpad('GEHU',10,'*') from dual;
<13>
SQL> select Instr('COCOON',’O’) from dual;
<14>
SQL> select replace('Dany','y','ie') from dual;
<15>
SQL> select translate('cold','ld','ol') from dual;
<16>
SQL> select sysdate from dual;
<17>
SQL> select round(sysdate)from dual;
<18>
SQL> select add_months(sysdate,3)from dual;
<19>
SQL> select last_day(sysdate)from dual;
<20>
SQL> select sysdate+20 from dual;
<21>
SQL> select next_day(sysdate,'tuesday')from dual;
NUMERIC FUNCTIONS:
<1>
SQL> select round(15.6789)from dual;
<2>
SQL> select ceil(23.20)from dual;
<3>
SQL> select floor(34.56)from dual;
<4>
SQL> select trunc(15.56743)from dual;
<5>
SQL> select sign(-345)from dual;
<6>
SQL> select abs(-70)from dual;
MATH FUNCTIONS:
<1>
SQL> select abs(45) from dual;
<2>
SQL> select power(10,12) from dual;
<3>
SQL> select mod(11,5) from dual;
<4>
SQL> select exp(10) from dual;
<5>
SQL> select sqrt(225) from dual;
PROGRAM – 5
Constraints-1
2. See and note the structure of above created table using “describe”. (Note structure
carefully)
and write answers for the following questions:
a. Which constraints are displayed in the structure?
b. Can you tell from the structure which column is Unique?
c. Can you tell from the structure which column is Primary and Which Not
Null?
d. Can you tell from the structure which column has check constrain?.
3. See the contents of “User_Constraints” table and note the constraint number and type
of constraints for your above table. (You can attach printout of this table)
4. Insert the following data in the above table (In case of Error , Correct the data yourself)
Write Each Query without using substitution and note the output of each.
6. See and note the structure of above created table using “describe”. (Note structure
carefully)
(if an error comes, first note the error and then correct the query)
8. See the contents of “User_Constraints” table and note the constraint number and type
of constraints for your above tables.
10. WAQ (write a query) to create an “Account4” table with following constraints:
11. See the contents of “User_Constraints” table and note the constraint number and
type
of constraints for your above table.
12. Drop the Primary Key & Unique Constraint from Account4 Table.
13. WAQ (write a query) to create an “Account5” table without any constraints:
16. Add the primary key constraint for AccountNo in Account5 Table
(If an error comes, note the error and write the reason)
17. In case of error in above ques, rectify the above table contents and repeat above
Question
(Write all the steps and queries)
18. See the contents of “User_Constraints” table and search the name of Account5 table
in it.
20. Add Check constraint in Account5 Table for Balance field. ( Amount > 1500)
21. In case of error in above ques, rectify the above table contents and repeat above
Question
(Write all the steps and queries)
22. See the contents of “User_Constraints” table and search the name of Account5 table
in it.
(Note the constraint number for account5 table)