SQL Programming Lab -Exercises
SQL Programming Lab -Exercises
SQL Programming Lab -Exercises
1. DDL: Data Definition Language (DDL) statements are used to define the database structure or
schema.
TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
2. DML: Data Manipulation Language (DML) statements are used for managing data within schema
DELETE - deletes all records from a table, the space for the records remain
3. DCL: Data Control Language (DCL) statements are used to create roles, permissions, and referential
integrity as well it is used to control access to database by securing it. To control the data of a database.
4. TCL: Transaction Control (TCL) statements are used to manage the changes made by DML
SAVEPOINT - identify a point in a transaction to which you can later roll back
SOLUTION:
number,sal number);
Table created.
EMPNO NUMBER
ENAME VARCHAR2(10)
JOB VARCHAR2(10)
MGR NUMBER
SAL NUMBER
Table altered.
EMPNO NUMBER
ENAME VARCHAR2(10)
JOB VARCHAR2(10)
MGR NUMBER
SAL NUMBER
COMMISSION NUMBER
1 row created.
SQL> /
1 row created.
1 row updated.
Table altered.
EMPNO NUMBER
ENAME VARCHAR2(10)
JOB VARCHAR2(10)
MANAGER_NO NUMBER
SAL NUMBER
COMMISSION NUMBER
1 row deleted.
SOLUTION:
Table created.
DEPTNO NUMBER
DEPTNAME VARCHAR2(10)
LOCATION VARCHAR2(10)
Table altered.
DEPTNO NUMBER
DEPTNAME VARCHAR2(10)
LOCATION VARCHAR2(10)
DESIGNATION VARCHAR2(10)
b. Insert values into the table.
1 row created.
SQL> /
1 row created.
1 row created.
DEPTNO DEPTNAME
---------- ----------
9 accounting
12 operations
10 research
11 sales
2 rows updated.
Table altered.
9 accounting hyderabad
10 research chennai
11 sales banglore
12 operations mumbai
9 accounting Chennai