SQL Fundamentals and SQL*Plus Commands

Test your knowledge of basic SQL queries, SQL*Plus commands, DDL statements, and database operations including SELECT, INSERT, TRUNCATE, subqueries, and Teradata-specific data types.

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

  1. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' ;
  2. SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson';
  3. SELECT FirstName='Peter', LastName='Jackson' FROM Persons
  4. SELECT FirstName LIKE 'Peter', LastName LIKE 'Jackson' FROM Persons
Question 2 Multiple Choice (Single Answer)

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

  1. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen' ;
  2. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' ;
  3. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons ;
  4. SELECT LastName LIKE'%Hansen%' AND LastName LIKE '%Pettersen%' FROM Persons ;
Question 3 Multiple Choice (Single Answer)

With SQL, how can you insert a new record into the "Persons" table?

  1. INSERT ('Jimmy', 'Jackson') INTO Persons ;
  2. INSERT VALUES ('Jimmy', 'Jackson') INTO Persons ;
  3. INSERT INTO Persons VALUES ('Jimmy', 'Jackson') ;
  4. INSERT VALUES ('Jimmy', 'Jackson') INTO Table Persons ;
Question 4 Multiple Choice (Single Answer)

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

  1. INSERT INTO Persons ('Olsen') INTO LastName ;
  2. INSERT INTO Persons (LastName) VALUES ('Olsen');
  3. INSERT ('Olsen') INTO Persons (LastName) ;
  4. INSERT INTO Table Persons (LastName) VALUES ('Olsen');
Question 5 Multiple Choice (Single Answer)

Which SQL statement is used to delete data and its tablespace from a database?

  1. DELETE
  2. TRUNCATE
  3. REMOVE
  4. None of the Above
Question 6 Multiple Choice (Single Answer)

With SQL, how do you select a column named "FirstName" from a table named "Persons"?

  1. SELECT Persons.FirstName ;
  2. EXTRACT FirstName FROM Persons ;
  3. SELECT FirstName FROM Persons;
  4. EXTRACT Persons.FirstName
Question 7 Multiple Choice (Single Answer)

Which SQL statement is used to return only different values?

  1. SELECT DIFFERENT
  2. SELECT DISTINCT
  3. SELECT UNIQUE
  4. All of the above
Question 8 Multiple Choice (Single Answer)

What does SQL stand for?

  1. Structured Query Language
  2. Strong Question Language
  3. Structured Question Language
  4. None of the Above
Question 9 Multiple Choice (Multiple Answers)

Which of the following data types are specific only to Teradata and not compatible to ANSI.

  1. LONG VARCHAR
  2. BYTEINT
  3. DATE
  4. TIMESTAMP WITH ZONE
Question 10 Multiple Choice (Single Answer)

Which of the following does not hold true for the subqueries?

  1. Can be the object of an IN or NOT IN clause
  2. Can be the object of EXISTS or NOT EXISTS
  3. Support quantifiers ALL, ANY, SOME
  4. Support LIKE or NOT LIKE used with a
  5. Cannot specify more than one column to match
Question 11 Multiple Choice (Single Answer)

Which of the following is not a DDL statement?

  1. CREATE
  2. DROP
  3. MODIFY
  4. ALTER
  5. GRANT
  6. REPLACE
Question 12 Multiple Choice (Single Answer)

Which SELECT statement should you use if you want to display unique combinations of the POSITION and MANAGER values from the EMPLOYEE table?

  1. SELECT DISTINCT position, manager
  2. SELECT position, manager DISTINCT
  3. SELECT position, manager
  4. SELECT position, DISTINCT manager
Question 13 Multiple Choice (Multiple Answers)

Which two are attributes of /SQL*Plus?

  1. SQL*Plus commands cannot be abbreviated.
  2. SQL*Plus commands are accesses from a browser.
  3. SQL*Plus commands are used to manipulate data in tables.
  4. SQL*Plus commands manipulate table definitions in the database.
Question 14 Multiple Choice (Single Answer)

Which is an /SQL*Plus command?

  1. Insert
  2. update
  3. select
  4. describe
  5. delete
  6. rename
Question 15 Multiple Choice (Single Answer)

Evaluate this SQL statement: SELECT e.EMPLOYEE_ID,e.LAST_NAME,e.DEPARTMENT_ID, d.DEPARTMENT_NAME. FROM EMP e, DEPARTMENT d WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID; In the statement, which capabilities of a SELECT statement are performed?

  1. Selection, projection, join
  2. Difference, projection, join
  3. Selection, intersection, join
  4. Intersection, projection, join
  5. Difference, projection, product
Question 16 Multiple Choice (Multiple Answers)

Which two statements are true regarding the ORDER BY clause?

  1. The sort is in ascending by order by default
  2. The sort is in descending order by default
  3. The ORDER BY clause must precede the WHERE clause.
  4. The ORDER BY clause is executed on the client side.
  5. The ORDER BY clause comes last in the SELECT statement.
  6. The ORDER BY clause is executed first in the query execution.
Question 17 Multiple Choice (Multiple Answers)

From SQLPlus, you issue this SELECT statement: SELECT From orders; You use this statement to retrieve data from a data table for __________.

  1. updating
  2. viewing
  3. deleting
  4. inserting
  5. truncating
Question 18 Multiple Choice (Single Answer)

Evaluate this SQL*Plus command: START delaccount Which task will this command accomplish?

  1. It executes the DELACCOUNT PL/SQL routine.
  2. It runs the DELACCOUNT.SQL script file.
  3. It creates the DELACCOUNT file using the default file extension.
  4. It invokes the editor to edit the contents of the DELACCOUNT file.
Question 19 Multiple Choice (Single Answer)

Which /SQL*Plus feature can be used to replace values in the WHERE clause?

  1. Substitution variables
  2. Replacement variables
  3. Prompt variables
  4. Instead-of variables