SQL Flashcards
How can you retrieve all rows from a database table called TRAINEE including all columns? Select one: a. SELECT * FROM TRAINEE b. SELECT % FROM TRAINEE c. RETRIEVE ALL FROM TRAINEE d. SELECT * IN TRAINEE
a. SELECT * FROM TRAINEE
How do you add a column to the table?
Select one:
a. ALTER TABLE table_name ADD column_name datatype
b. CHANGE TABLE table_name ADD column_name datatype
c. ADD COLUMN IN table_name SET column_name datatype
d. ALTER COLUMN column_name SET datatype
a. ALTER TABLE table_name ADD column_name datatype
How do you add a record to a table?
Select one:
a. SAVE TABLE_NAME VALUES( ___ , ___ , ___ , ___ )
b. INSERT INTO TABLE_NAME VALUES( ___ , ___ , ___ , ___ )
c. UPDATE TABLE_NAME SET ROW VALUES( ___ , ___ , ___ , ___ )
d. PUT INTO TABLE_NAME VALUES( ___ , ___ , ___ , ___ )
b. INSERT INTO TABLE_NAME VALUES( ___ , ___ , ___ , ___ )
How do you drop a table? Select one: a. DROP TABLE table_name b. DROP TABLE WHERE TABLE = table_name c. DROP TABLE column_list d. DROP TABLE
a. DROP TABLE table_name
How would use IN and EXIST?
Select one:
a. EXISTS works best for a small finite set of data, whereas IN is better for subqueries
b. IN works best for a small finite set of data, whereas EXISTS is better for subqueries
c. EXISTS returns a boolean if the row exists, where IN returns the table name a row is located in
d. IN is used in queries (i.e. SELECT * IN TABLE_NAME), where EXISTS finds if a table exists
b. IN works best for a small finite set of data, whereas EXISTS is better for subqueries
If TableA has 100 rows and TableB has 10 rows, how many rows would be retrieved from the following query: SELECT * FROM TableA, TableB Select one: a. 100 b. 1000 c. 10 d. 10000
b. 1000
What is a cursor?
Select one:
a. A temporary index to place on a table
b. The icon used to point to the buttons on the GUI
c. A pointer to the context area that holds the rows returned by a SQL statement
d. A stored procedure that triggers on a DDL statement
c. A pointer to the context area that holds the rows returned by a SQL statement
What is a primary key?
Select one:
a. A column (or columns) that references a column of another table to establish a relationship between rows
b. The identifier for the database
c. A key used to access a secured database table
d. A column or group of columns that uniquely identify a row
d. A column or group of columns that uniquely identify a row
What is a foreign key?
Select one:
a. A key used to access a secured database table
b. A column or group of columns that uniquely identify a row
c. The identifier for the database
d. A column (or columns) that references a column of another table to establish a relationship between rows
d. A column (or columns) that references a column of another table to establish a relationship between rows
What is a trigger?
Select one:
a. Stored programs in PL/SQL which are automatically executed or fired when some event occurs
b. Stored programs in ANSI SQL which are automatically executed or fired when some event occurs
c. A block of SQL code that runs on a timer
d. PL/SQL does not support triggers
a. Stored programs in PL/SQL which are automatically executed or fired when some event occurs
What is a view?
Select one:
a. A GUI for accessing data returned by a SQL statement
b. A physical table created by the database based on the result-set of an SQL statement
c. A virtual table based on the result-set of an SQL statement
d. Another name for a table in SQL
c. A virtual table based on the result-set of an SQL statement
What is not a use of the WHERE clause?
Select one:
a. WHERE can be used with UPDATE statements
b. WHERE can be used with DELETE statements
c. WHERE locates which database/schema/table where a row is located
d. WHERE places a restriction on the rows returned by a query
c. WHERE locates which database/schema/table where a row is located
What is not true about DELETE, TRUNCATE, and DROP?
Select one:
a. The DELETE command is used to remove rows from a table
b. The DELETE command can use a WHERE clause to restrict the rows deleted
c. The DROP command removes a database from a table
d. TRUNCATE cannot be rolled back and no triggers will be fired
c. The DROP command removes a database from a table
What is not true about referential integrity?
Select one:
a. A foreign key in any referencing table must always refer to a valid row in the referenced table
b. Oracle supports referential integrity actions, such as DELETE CASCADE and DELETE SET NULL
c. A row that holds a reference to a child record can be deleted before the child record is
d. Ensures that the relationship between two tables remains synchronized during updates and deletes
c. A row that holds a reference to a child record can be deleted before the child record is
What is the difference between INNER JOIN and OUTER JOIN?
Select one:
a. An outer join will return only the rows that match based on the join predicate
b. An outer join will return all rows in the left table and those that match in the right table
c. Inner join will return only the rows that match based on the join predicate
d. An inner join will return rows that are not common between both table
c. Inner join will return only the rows that match based on the join predicate