Vous êtes sur la page 1sur 5

Assignment 7 1.

create the table with the following structure Field Name Data type Id Number(4) Last_name Varchar2(25) First_name Varchar2(25) Userid Varchar2(9) Salary Number(9,2)

Name ID LAST_NAME FIRST_NAME USER_ID SALARY

Null? NUMBER(4)

Type VARCHAR2(25) VARCHAR2(25) VARCHAR2(9) NUMBER(9,2)

2. ID 1 2 3 4

Add the following data to the table. Concatenate the first letter of the first_name & the first seven characters of the last name to produce user id. Last_name First_name Userid Salary Patel Ralph Rpatel 895 Dancs Betty Bdancs 860 Brij Ben Bbrij 1100 Newman Chad Cnewman 750

ID

LAST_NAME

FIRST_NAME ralph betty

USER_ID rpatel bdances

SALARY 895 860

1 patel 2 dances

3 brij 4 newman 3.

ben chad

bbrij cnewman

1100 750

Make the data additions permanent.

Commit complete. 3. Change the last_name of employee 3 to Drexler.

1 rows updated.

ID

LAST_NAME

FIRST_NAME ralph betty ben chad

USER_ID rpatel bdances bbrij cnewman

SALARY 895 860 1100 750

1 patel 2 dances 3 drexler 4 newman

4. Change the salary to 1000 for all employees with a salary less than 900.

3 rows updated.

ID

LAST_NAME

FIRST_NAME ralph betty ben chad

USER_ID rpatel bdances bbrij cnewman

SALARY 1000 1000 1100 1000

1 patel 2 dances 3 drexler 4 newman

5. Make the changes permanent. Commit complete.

6. Delete Betty Dancs from the table.

1 row deleted. ID LAST_NAME FIRST_NAME ralph ben chad USER_ID rpatel bbrij cnewman SALARY 1000 1100 1000

1 patel 3 drexler 4 newman

7. Confirm your changes to the table. Commit complete. 8. Populate the table with two more rows of data.

1 row created. ID LAST_NAME FIRST_NAME ralph ben chad keshav ratandeep USER_ID rpatel bbrij cnewman ktalreja rsingh SALARY 1000 1100 1000 1200 10000

1 patel 3 drexler 4 newman 5 talreja 6 singh

9. Confirm your changes to the table.

Commit complete. ID LAST_NAME FIRST_NAME ralph USERID rpatel SALARY 1000

1 patel

2 Talreja 3 Drexlet 4 newman 5 Gupta

Keshav ben chad Nikhil

KTalreja bbrij cnewman NGupta

1000 1100 1000 1100

10. Mark an intermediate point in the processing of the transaction.

Savepoint created. ID LAST_NAME FIRST_NAME ralph Keshav ben chad Nikhil USERID rpatel KTalreja bbrij cnewman NGupta SALARY 1000 1000 1100 1000 1100

1 patel 2 Talreja 3 Drexlet 4 newman 5 Gupta 11. Empty the entire table. 5 rows deleted.

12. Confirm that the table is empty

no rows selected 13. Discard the most recent Delete operation without discarding the earlier insert operation.

Rollback complete. 14. Make the addition permanent.

Commit complete.

Vous aimerez peut-être aussi