1. Which command is used to create a table based upon data already contained in an existing table? CREATE TABLE command with a subquery
2. List four datatypes supported by Oracle10g, and provide an example of data that could be stored by each datatype. DATE – 20-JAN-99, VARCHAR2 – HELLO, NUMBER – 5.23, CHAR - HELLO
3. What are the guidelines you should follow when naming tables and columns in Oracle10g? A maximum of 30 characters are allowed, the first character must be a letter, no blank spaces or special symbols other than underscore and dollar signs cannot be included. Also, reserve words cannot be used as a table or column name.
4. What is the difference between dropping a column and setting a column as unused? When dropped, the storage space is released immediately. When set as unused, the storage space is not released until a later time.
5. How many columns can be dropped in one ALTER TABLE command? Only one at a time
6. What happens to the existing rows of a table if the DEFAULT value of a column is changed? Nothing – they are not affected
7. Explain the difference between truncating a table and deleting a table. Truncating a table will remove all the data, but retain the table structure while deleting (dropping) a table will remove the data and the table structure from the database.
8. If you add a new column to an existing table, where will the column appear relative to the existing columns? It will appear as the last column in the table.
9. What happens if you try to decrease the scale or precision of a NUMBER column to a value less than the data already stored in the field? You cannot change the scale or precision of a NUMBER column that contains data.
10. Is a table and the data data contained in the table permanently erased from the system if a DROP TABLE command is issued on the table? The table is permanently erased only if the PURGE option is used in the DROP TABLE command. Otherwise, the table will be moved to the recyclebin.
Multiple Choice
1. c
2. c
3. a
4. b
5. d
6. d
7. b
8. d
9. b
10. a
11. d
12. a
13. a
14. c
15. d
16. d
17. b
18. d
19. b
20. b
Case Study: City Jail
Notes:
In Section A, students will need to develop create table statements for each of the tables listed. The listing indicates DEFAULT column values where applicable. The listing entitled “Coding Key for selected columns” is only provided to help the student visualize what type of data will be entered into selected code columns. This will be a valuable reference for accomplishing queries in later chapters.
In Section B, students will need to use the ALTER TABLE command to make the requested table modifications.
Warning: If you modify this assignment consider how this will affect the case study assignments in the