1.Create an INVOICE_2 table from the INVOICE table using a selec.docx
38 views
7 slides
Dec 01, 2022
Slide 1 of 7
1
2
3
4
5
6
7
About This Presentation
1.Create an INVOICE_2 table from the INVOICE table using a select statement
2.
Modify the INVOICE table to allow for longer DESCRIPTION names.
3. Rename the INVOICE_2 table to INVOICE_3.
4. Add a named table level foreign key reference on the INVOICE table that will ensure that the PRODID is not...
1.Create an INVOICE_2 table from the INVOICE table using a select statement
2.
Modify the INVOICE table to allow for longer DESCRIPTION names.
3. Rename the INVOICE_2 table to INVOICE_3.
4. Add a named table level foreign key reference on the INVOICE table that will ensure that the PRODID is not assigned to a nonexistent PRODUCT
5. Change the value for one of the DESCRIPTIONS.
6. Create a PRIMARY KEY constraint on the INVOICE table using the ORDID column. The constraint should be named at creation as a named table
7. Create a query to display the employee number, last name and hire date for all employees who have a salary greater than the average salary. Sort the results in descending order of salary.
8. Create a sequence to be used with the primary key column of the INVOICE table. The sequence should start at 1000 and have a maximum value of 2000. Have your sequence increment by a single number. Name the sequence INVOICE_SEQ. Do not allow the sequence to cycle or cache.
9. Create a synonym for the INVOICE table.
10. Create a view called INVOICE_View based on four columns in the INVOICE table. Use SQL*PLUS formatting commands to create column headings for the four columns.
11. Create a view named INV_VIEW_QUERY that does not allow an invoice DESCRIPTION to be changed through the view.
12.
Create an INVOICE table based on the following.
NAME NULL? TYPE
ORDID
NOT NULL
NUMBER(4)
ITEMID
NOT NULL
NUMBER(4)
DESCRIPTION
NOT NULL
VARCHAR2(20)
PRODID
NUMBER(6)
ACTUALPRICE
NUMBER(8,2)
QTY
NUMBER(8)
ITEMTOT
NUMBER(8,2)
13.
Create an ORDERS_(your initials) table based on the following:.
NAME NULL? TYPE
ORDID
NOT NULL
NUMBER(4)
ORDERDATE
DATE
COMMPLAN
VARCHAR2(1)
CUSTID
NOT NULL
NUMBER(6)
SHIPDATE
DATE
14.
Modify the INVOICE table. Add a CHECK constraint to prevent any ACTUALPRICE greater than what you think is a reasonable level
15. Modify the INVOICE table by making one of the columns NOT NULL
16.
Modify the INVOICE_3 table. Add an ORD_DATE column of DATE datatype.
17.
Populate the table with the four rows of sample data by running the script that you created
18. Using your view INVOICE_View, enter a query to display values for three of the four columns included in the view.
19. Write a query to display the three columns of data for all employees with the same MANAGER_ID as Grant.
20Write an interactive script to insert a row into the INVOICE table. Name your script Be sure to use the sequence that you created for the primary key column. Create a customized prompt to enter the DESCRIPTION. Execute your script.
This is the tables
TABLE_NAME
------------------------------
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
COUNTRIES
.
Size: 192.36 KB
Language: en
Added: Dec 01, 2022
Slides: 7 pages
Slide Content
1.Create an INVOICE_2 table from the INVOICE table using a
select statement
2.
Modify the INVOICE table to allow for longer DESCRIPTION
names.
3. Rename the INVOICE_2 table to INVOICE_3.
4. Add a named table level foreign key reference on the
INVOICE table that will ensure that the PRODID is not
assigned to a nonexistent PRODUCT
5. Change the value for one of the DESCRIPTIONS.
6. Create a PRIMARY KEY constraint on the INVOICE table
using the ORDID column. The constraint should be named at
creation as a named table
7. Create a query to display the employee number, last name
and hire date for all employees who have a salary greater than
the average salary. Sort the results in descending order of
salary.
8. Create a sequence to be used with the primary key column of
the INVOICE table. The sequence should start at 1000 and have
a maximum value of 2000. Have your sequence increment by a
single number. Name the sequence INVOICE_SEQ. Do not
allow the sequence to cycle or cache.
9. Create a synonym for the INVOICE table.
10. Create a view called INVOICE_View based on four columns
in the INVOICE table. Use SQL*PLUS formatting commands to
create column headings for the four columns.
11. Create a view named INV_VIEW_QUERY that does not
allow an invoice DESCRIPTION to be changed through the
view.
12.
Create an INVOICE table based on the following.
NAME NULL? TYPE
ORDID
NOT NULL
NUMBER(4)
ITEMID
NOT NULL
NUMBER(4)
DESCRIPTION
NOT NULL
VARCHAR2(20)
PRODID
NUMBER(6)
ACTUALPRICE
NUMBER(8,2)
QTY
NUMBER(8)
ITEMTOT
NUMBER(8,2)
13.
Create an ORDERS_(your initials) table based on the
following:.
NAME
NULL? TYPE
ORDID
NOT NULL
NUMBER(4)
ORDERDATE
DATE
COMMPLAN
VARCHAR2(1)
CUSTID
NOT NULL
NUMBER(6)
SHIPDATE
DATE
14.
Modify the INVOICE table. Add a CHECK constraint to
prevent any ACTUALPRICE greater than what you think is a
reasonable level
15. Modify the INVOICE table by making one of the columns
NOT NULL
16.
Modify the INVOICE_3 table. Add an ORD_DATE column of
DATE datatype.
17.
Populate the table with the four rows of sample data by running
the script that you created
18. Using your view INVOICE_View, enter a query to display
values for three of the four columns included in the view.
19. Write a query to display the three columns of data for all
employees with the same MANAGER_ID as Grant.
20Write an interactive script to insert a row into the INVOICE
table. Name your script Be sure to use the sequence that you
created for the primary key column. Create a customized prompt
to enter the DESCRIPTION. Execute your script.
This is the tables
TABLE_NAME
------------------------------
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
COUNTRIES