SlideShare a Scribd company logo
1 of 3
Department of Computer Technology and Information Systems
                                                2012-2013 Fall Semester
                   CTIS259 Database Management Systems and Applications

                                                  Lab Guide 10
Instructor      : Füsun Yürüten                                                            Week:   7
Assistant       : Hatice Z. Yılmaz                                                         Date:   05-06.11.2012

Aim of this lab session:             1. Manipulating Data (Add, Delete, Update)
                                     2. Controlling Transactions (Commit, Savepoint, Rollback)



ORACLE Server Configurations:
IP Address: 139.179.33.230
Port number: 1521
SID: ctisorcl




Practices for Lesson 10
Lesson Overview
In this practice, you add rows to the MY_EMPLOYEE table, update and delete data from the table, and
control your transactions. You run a script to create the MY_EMPLOYEE table.

Practice 10-1: Manipulating Data
The HR department wants you to create SQL statements to insert, update, and delete employee data.
As a prototype, you use the MY_EMPLOYEE table before giving the statements to the HR
department.
Note: For all the DML statements, use the Run Script icon (or press [F5]) to execute the query. This way
you get to see the feedback messages on the Script Output tabbed page. For SELECT queries,
continue to use the Execute Statement icon or press [F9] to get the formatted output on the Results
tabbed page.

Insert data into the MY_EMPLOYEE table.
1. Run the statement in the lab_10_01.sql script to build the MY_EMPLOYEE table used in this
practice.

2. Describe the structure of the MY_EMPLOYEE table to identify the column names.




                                                             1
3. Create an INSERT statement to add the first row of data to the MY_EMPLOYEE table from the
following sample data. Do not list the columns in the INSERT clause. Do not enter all rows yet.




4. Populate the MY_EMPLOYEE table with the second row of the sample data from the preceding list.
This time, list the columns explicitly in the INSERT clause.

5. Confirm your addition to the table.




6. Write an INSERT statement in a dynamic reusable script file to load the remaining rows into the
MY_EMPLOYEE table. The script should prompt for all the columns (ID, LAST_NAME, FIRST_NAME,
USERID, and SALARY). Save this script to a lab_10_06.sql file.

7. Populate the table with the next two rows of the sample data listed in step 3 by running the INSERT
statement in the script that you created.

8. Confirm your additions to the table.




9. Make the data additions permanent.

Update and delete data in the MY_EMPLOYEE table.
10. Change the last name of employee 3 to Drexler.

11. Change the salary to $1,000 for all employees who have a salary less than $900.

12. Verify your changes to the table.




                                                   2
13. Delete Betty Dancs from the MY_EMPLOYEE table.

14. Confirm your changes to the table.




15. Commit all pending changes.

Control data transaction to the MY_EMPLOYEE table.
16. Populate the table with the last row of the sample data listed in step 3 by using the statements in the
script that you created in step 6. Run the statements in the script.

17. Confirm your addition to the table.




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

19. Delete all the rows from the MY_EMPLOYEE table.

20. Confirm that the table is empty.

21. Discard the most recent DELETE operation without discarding the earlier INSERT operation.

22. Confirm that the new row is still intact.




23. Make the data addition permanent.

24. Modify the lab_10_06.sql script such that the USERID is generated automatically by
concatenating the first letter of the first name and the first seven characters of the last name. The
generated USERID must be in lowercase. Therefore, the script should not prompt for the USERID. Save
this script to a file named lab_10_24.sql.




25. Run the lab_10_24.sql script to insert the following record:

26. Confirm that the new row was added with correct USERID.




                                                     3

More Related Content

Similar to Lab guide10

Access tips access and sql part 3 practical examples
Access tips  access and sql part 3  practical examplesAccess tips  access and sql part 3  practical examples
Access tips access and sql part 3 practical examplesquest2900
 
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docxThis is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docxabhi353063
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL IISankhya_Analytics
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)Achmad Solichin
 
Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7helpido9
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL UsedTheVerse1
 
New features of sql server 2005
New features of sql server 2005New features of sql server 2005
New features of sql server 2005Govind Raj
 
Itm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers keyItm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers keySong Love
 
Oracle OCP 1Z0-007题库
Oracle OCP 1Z0-007题库Oracle OCP 1Z0-007题库
Oracle OCP 1Z0-007题库renguzi
 
e computer notes - Manipulating data
e computer notes - Manipulating datae computer notes - Manipulating data
e computer notes - Manipulating dataecomputernotes
 
OBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsOBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsDharmaraj Borse
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
 
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxCharles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxchristinemaritza
 

Similar to Lab guide10 (20)

Access tips access and sql part 3 practical examples
Access tips  access and sql part 3  practical examplesAccess tips  access and sql part 3  practical examples
Access tips access and sql part 3 practical examples
 
T6
T6T6
T6
 
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docxThis is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL II
 
Les09.ppt
Les09.pptLes09.ppt
Les09.ppt
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
 
Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7Cis 407 i lab 5 of 7
Cis 407 i lab 5 of 7
 
Les08
Les08Les08
Les08
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
 
New features of sql server 2005
New features of sql server 2005New features of sql server 2005
New features of sql server 2005
 
Unit 2 web technologies
Unit 2 web technologiesUnit 2 web technologies
Unit 2 web technologies
 
50 MS Excel Tips and Tricks
50 MS Excel Tips and Tricks 50 MS Excel Tips and Tricks
50 MS Excel Tips and Tricks
 
Itm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers keyItm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers key
 
Oracle OCP 1Z0-007题库
Oracle OCP 1Z0-007题库Oracle OCP 1Z0-007题库
Oracle OCP 1Z0-007题库
 
Sql midterm
Sql midtermSql midterm
Sql midterm
 
mis4200notes4_2.ppt
mis4200notes4_2.pptmis4200notes4_2.ppt
mis4200notes4_2.ppt
 
e computer notes - Manipulating data
e computer notes - Manipulating datae computer notes - Manipulating data
e computer notes - Manipulating data
 
OBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsOBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation Steps
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
 
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docxCharles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
Charles WilliamsCS362Unit 3 Discussion BoardStructured Query Langu.docx
 

Lab guide10

  • 1. Department of Computer Technology and Information Systems 2012-2013 Fall Semester CTIS259 Database Management Systems and Applications Lab Guide 10 Instructor : Füsun Yürüten Week: 7 Assistant : Hatice Z. Yılmaz Date: 05-06.11.2012 Aim of this lab session: 1. Manipulating Data (Add, Delete, Update) 2. Controlling Transactions (Commit, Savepoint, Rollback) ORACLE Server Configurations: IP Address: 139.179.33.230 Port number: 1521 SID: ctisorcl Practices for Lesson 10 Lesson Overview In this practice, you add rows to the MY_EMPLOYEE table, update and delete data from the table, and control your transactions. You run a script to create the MY_EMPLOYEE table. Practice 10-1: Manipulating Data The HR department wants you to create SQL statements to insert, update, and delete employee data. As a prototype, you use the MY_EMPLOYEE table before giving the statements to the HR department. Note: For all the DML statements, use the Run Script icon (or press [F5]) to execute the query. This way you get to see the feedback messages on the Script Output tabbed page. For SELECT queries, continue to use the Execute Statement icon or press [F9] to get the formatted output on the Results tabbed page. Insert data into the MY_EMPLOYEE table. 1. Run the statement in the lab_10_01.sql script to build the MY_EMPLOYEE table used in this practice. 2. Describe the structure of the MY_EMPLOYEE table to identify the column names. 1
  • 2. 3. Create an INSERT statement to add the first row of data to the MY_EMPLOYEE table from the following sample data. Do not list the columns in the INSERT clause. Do not enter all rows yet. 4. Populate the MY_EMPLOYEE table with the second row of the sample data from the preceding list. This time, list the columns explicitly in the INSERT clause. 5. Confirm your addition to the table. 6. Write an INSERT statement in a dynamic reusable script file to load the remaining rows into the MY_EMPLOYEE table. The script should prompt for all the columns (ID, LAST_NAME, FIRST_NAME, USERID, and SALARY). Save this script to a lab_10_06.sql file. 7. Populate the table with the next two rows of the sample data listed in step 3 by running the INSERT statement in the script that you created. 8. Confirm your additions to the table. 9. Make the data additions permanent. Update and delete data in the MY_EMPLOYEE table. 10. Change the last name of employee 3 to Drexler. 11. Change the salary to $1,000 for all employees who have a salary less than $900. 12. Verify your changes to the table. 2
  • 3. 13. Delete Betty Dancs from the MY_EMPLOYEE table. 14. Confirm your changes to the table. 15. Commit all pending changes. Control data transaction to the MY_EMPLOYEE table. 16. Populate the table with the last row of the sample data listed in step 3 by using the statements in the script that you created in step 6. Run the statements in the script. 17. Confirm your addition to the table. 18. Mark an intermediate point in the processing of the transaction. 19. Delete all the rows from the MY_EMPLOYEE table. 20. Confirm that the table is empty. 21. Discard the most recent DELETE operation without discarding the earlier INSERT operation. 22. Confirm that the new row is still intact. 23. Make the data addition permanent. 24. Modify the lab_10_06.sql script such that the USERID is generated automatically by concatenating the first letter of the first name and the first seven characters of the last name. The generated USERID must be in lowercase. Therefore, the script should not prompt for the USERID. Save this script to a file named lab_10_24.sql. 25. Run the lab_10_24.sql script to insert the following record: 26. Confirm that the new row was added with correct USERID. 3