0% found this document useful (0 votes)
44 views2 pages

Implementation of DDL and DML Statements With Constraints: Name Type

The document discusses implementing DDL and DML statements to create an EMP table with constraints and inserting records. It also discusses retrieving data from an EMPLOYEE table using SELECT statements and creating a new EMP table with the same data.

Uploaded by

Demo 2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views2 pages

Implementation of DDL and DML Statements With Constraints: Name Type

The document discusses implementing DDL and DML statements to create an EMP table with constraints and inserting records. It also discusses retrieving data from an EMPLOYEE table using SELECT statements and creating a new EMP table with the same data.

Uploaded by

Demo 2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Implementation of DDL and DML Statements with Constraints

1. Create a table called EMP with the following structure.


Name Type
----------- -------------------
EMPNO NUMBER (6)
ENAME VARCHAR2 (20)
JOB VARCHAR2 (10)
DEPTNO NUMBER (3)
SAL NUMBER (7,2)

a) Allow NULL for all columns except ename and job.


b) Add constraints to check, while entering the empno value (i.e) empno > 100.
c) Define the field DEPTNO as unique.
d) Create a primary key constraint for the table (EMPNO).
e) Write some queries by yourself (at least 4) to implement and practice constraints.

Note: After creating table insert at least 08 records & check the conditions as mentioned above.
Retrieving data using SQL Select Statement

1. Create a table EMPLOYEE with following schema:


(Emp_no, E_name, E_address, E_ph_no, Dept_no, Dept_name, Job_id , Salary

a) Display all the information of EMP table.


b) Display the record of each employee who works in department D10.
c) Display the details of Employee who works in department MECH.
d) Display the complete record of employees working in SALES Department.
e) Display the emp_no, e_name and salary of all employees.

HINT: After creating table insert at least 03 records against each department name as given
below. You may start Dept-no as D1, D2…… D15 and Dept-name as SALES, MECHANICAL,
ELECTRICAL, CIVIL, FIA, ELECTRONICS. INSERT.

2. Create a new table “EMP” having same column/data as EMPLOYEE by using Select Statement.

You might also like