Week 9 Flashcards
Creating/Modifying Tables
What language is used to create and modify tables?
A. data design language (ddl)
B. data information language (dil)
C. data definition language (ddl)
D. simple query language (sql)
C. data definition language (ddl)
A variable length character data. the (n) is the maximum length.
A. VARCHAR2(n)
B. CHAR(n)
C.CHAR2(n)
D. NUMBER(n)
A. VARCHAR2(n)
A fixed length character folumn. The (n) is the column length.
A. VARCHAR2(n)
B. CHAR(n)
C.CHAR2(n)
D. NUMBER(n)
B. CHAR(n)
The p in NUMBER(p,s) stands for what? Select all that apply.
A. Precision
B. Percent
C. total number of digits
D. digits only to the left of the decimal
A. Precision
C. total number of digits
The type of data Oracle12C is expected to store in a column is called what?
datatype
How many columns can a table contain?
A. 100
B. 1000
C. 10000
D. none of the above
B. 1000
True/False: When creating a table, columns should be enclosed in parenthesis.
True
When creating a table, the columns must have what after the name to define them?
A. datatype
B. datafield
C. datadefinition
D. None of the above
A. datatype
What command do you use to add rows after a table is created?
A. ADD
B. INSERT
C. CREATE RECORD
B. INSERT
To view the stRucture of a table, what command do you use?
A. SHOW SCHEMA
B. DETAILS
C. DESCRIBE
C. DESCRIBE
Choose the correct syntax for creating a table.
A. CREATE TABLE test
(ID CHAR(4)
name VARCHAR2(15)
bday DATE DEFAULT SYSDATE);
B. CREATE TABLE test
(ID CHAR(4),
name VARCHAR2(15),
bday DATE DEFAULT SYSDATE)
C. CREATE TABLE test
(ID CHAR(4),
name VARCHAR2(15),
bday DATE DEFAULT SYSDATE;
D. CREATE TABLE test
(ID CHAR(4),
name VARCHAR2(15),
bday DATE DEFAULT SYSDATE);
D. CREATE TABLE test
(ID CHAR(4),
name VARCHAR2(15),
bday DATE DEFAULT SYSDATE);
The _____ data dictionary object maintains information on all your tables. Use it to show all the tables in your schema.
A. TABLES_DATA
B. USER_TABLES
C. USER_DATA
D. TABLES_USER
B. USER_TABLES
The ___ TABLE command is used to modify tables.
A. ALTER
B. CHANGE
C. MODIFY
A. ALTER
Using the ALTER TABLE ADD does what?
Adds a column
To change the column definition after it’s already been created what syntax do you use?
A. ALTER TABLE CHANGE
B. ALTER TABLE FIX
C. ALTER TABLE MODIFY
C. ALTER TABLE MODIFY
Which of the following are true of modifying existing columns?
A. it must be as wide as the data fields it already contains
B. Changes to a NUMBER column that already contains data will erase the data
C. You cannot decrease the precision or scale of a NUMBER column if it already contains data
A. it must be as wide as the data fields it already contains
C. You cannot decrease the precision or scale of a NUMBER column if it already contains data
What command is used in creating a table or columns to set the date to the current date without the user inputting data?
SYSDATE
To create a table from an existing table what command do you use?
A. CREATE FROM
B. CREATE TABLE…AS
C. NEW TABLE…AS
D. NEW TABLE FROM
B. CREATE TABLE…AS
Use the ALTER TABLE _____ COLUMN to delete an existing column from a table.
A. DROP
B. DELETE
C. REMOVE
D. ERASE
A. DROP
You cannot remove what two types of columns from a table?
Primary key column
last column in the table
The SET UNUSED command is used to what? It makes the data in the column unavailable.
Marks it for deletion at another time.
Useful to use in production environments if you want the data to be ‘gone’ but you do not want the server to process it until a time there is less load on the server.
True/False: You can query a table based on it’s old name if you used the RENAME command.
False
If you want to remove all the records (rows) in a table, but keep the columns, what command would you use?
A. REMOVE ALL
B. DELETE * ROWS
C. TRUNCATE TABLE
D. TRUNCATE RECORDS
C. TRUNCATE TABLE
The DROP TABLE command does what?
Deletes an entire table, structure and data.
True/False: After using the DROP TABLE command, it can be recovered from a recycle bin.
True
What command is used to restore a table after it was deleted?
A. FLASHBACK TABLE
B. RESTORE TABLE
C. RECREATE TABLE
A. FLASHBACK TABLE
Use the ____ TABLE to remove it from the recycle bin.
A. DELETE
B. REMOVE
C. ERASE
D. PURGE
D. PURGE
What constraint type cannot be created at the table level?
NOT NULL
True/False: If a data value violates a constraint, the entire row is rejected
True
True/False: You can delete a value in a parent table if it is referenced by a child table? (foreign keys)
No
If a value is referenced in another table, it cannot be deleted.
What command is used to automatically set a parent row value to delete if the foreign key value is deleted in a child table?
A. ON DELETE REPLICATE
B. ON DELETE CASCADE
C. ON DELETE PARENT
D. ON DELETE PURGE
A. ON DELETE REPLICATE
The _____ constraint is used to verify another condition is true before accepting input.
A. VERIFY
B. CHECK
C. UNIQUE
B. CHECK
What command is used to display constraint listing for a specific table?
USER_CONSTRAINTS
Use the ____ command to stop using a constraint.
DISABLE