1. Add a table-level PRIMARY KEY constraint to the EMP table on the ID column. The constraint should be named at creation. Name the constraint my_emp_id_pk
2. Create a PRIMARY KEY constraint to the DEPT table using the ID column. The constraint
should be named at creation. Name the constraint my_dept_id_pk.
3. Add a column DEPT_ID to the EMP table. Add a foreign key reference on the EMP table that ensures that the employee is not assigned to a nonexistent department. Name the constraint
my_emp_dept_id_fk.
4.Confirm that the constraints were added by querying the USER_CONSTRAINTS view. Note the types and names of the constraints.
5. Display the object names and types from the USER_OBJECTS data dictionary view for the EMP and DEPT tables. Notice that the new tables and a new index were created.
6. Modify the EMP table. Add a COMMISSION column of NUMBER data type, precision 2, scale 2. Add a constraint to the commission column that ensures that a commission value is greater than zero.
7.Create the EMPLOYEES2 table based on the structure of the EMPLOYEES table. Include only
the EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY, and DEPARTMENT_ID columns.
Name the columns in your new table ID, FIRST_NAME, LAST_NAME, SALARY , and
DEPT_ID, respectively.
8. Create the DEPT table based on the following table instance chart, then execute the statement in the script to create the table. Confirm that the table is created.
ID NUMBER 7
NAME VARCHAR2 25
9. Populate the DEPT table with data from the DEPARTMENTS table. Include only columns that
you need.
Subscribe to:
Post Comments (Atom)
5 comments:
its a very good application program to enhance our knowledge in dbms programming ......... i extend cordial thanks to all teachers involved in it.......
good for us and help us to be sincere and in a systematic one
Hmmmmmmmmmmmmmm....dats true...:)
YAits
Thank U Rajeeb sir and Suchismita Mam for ur kind cooperation and support in the LAB sessions.
Post a Comment