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.
Questions
With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
- SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' ;
- SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson';
- SELECT FirstName='Peter', LastName='Jackson' FROM Persons
- SELECT FirstName LIKE 'Peter', LastName LIKE 'Jackson' FROM Persons
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"?
- SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen' ;
- SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' ;
- SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons ;
- SELECT LastName LIKE'%Hansen%' AND LastName LIKE '%Pettersen%' FROM Persons ;
With SQL, how can you insert a new record into the "Persons" table?
- INSERT ('Jimmy', 'Jackson') INTO Persons ;
- INSERT VALUES ('Jimmy', 'Jackson') INTO Persons ;
- INSERT INTO Persons VALUES ('Jimmy', 'Jackson') ;
- INSERT VALUES ('Jimmy', 'Jackson') INTO Table Persons ;
With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
- INSERT INTO Persons ('Olsen') INTO LastName ;
- INSERT INTO Persons (LastName) VALUES ('Olsen');
- INSERT ('Olsen') INTO Persons (LastName) ;
- INSERT INTO Table Persons (LastName) VALUES ('Olsen');
Which SQL statement is used to delete data and its tablespace from a database?
- DELETE
- TRUNCATE
- REMOVE
- None of the Above
With SQL, how do you select a column named "FirstName" from a table named "Persons"?
- SELECT Persons.FirstName ;
- EXTRACT FirstName FROM Persons ;
- SELECT FirstName FROM Persons;
- EXTRACT Persons.FirstName
Which SQL statement is used to return only different values?
- SELECT DIFFERENT
- SELECT DISTINCT
- SELECT UNIQUE
- All of the above
What does SQL stand for?
- Structured Query Language
- Strong Question Language
- Structured Question Language
- None of the Above
Which of the following data types are specific only to Teradata and not compatible to ANSI.
- LONG VARCHAR
- BYTEINT
- DATE
- TIMESTAMP WITH ZONE
Which of the following does not hold true for the subqueries?
- Can be the object of an IN or NOT IN clause
- Can be the object of EXISTS or NOT EXISTS
- Support quantifiers ALL, ANY, SOME
- Support LIKE or NOT LIKE used with a
- Cannot specify more than one column to match
Which of the following is not a DDL statement?
- CREATE
- DROP
- MODIFY
- ALTER
- GRANT
- REPLACE
Which SELECT statement should you use if you want to display unique combinations of the POSITION and MANAGER values from the EMPLOYEE table?
- SELECT DISTINCT position, manager
- SELECT position, manager DISTINCT
- SELECT position, manager
- SELECT position, DISTINCT manager
Which two are attributes of /SQL*Plus?
- SQL*Plus commands cannot be abbreviated.
- SQL*Plus commands are accesses from a browser.
- SQL*Plus commands are used to manipulate data in tables.
- SQL*Plus commands manipulate table definitions in the database.
Which is an /SQL*Plus command?
- Insert
- update
- select
- describe
- delete
- rename
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?
- Selection, projection, join
- Difference, projection, join
- Selection, intersection, join
- Intersection, projection, join
- Difference, projection, product
Which two statements are true regarding the ORDER BY clause?
- The sort is in ascending by order by default
- The sort is in descending order by default
- The ORDER BY clause must precede the WHERE clause.
- The ORDER BY clause is executed on the client side.
- The ORDER BY clause comes last in the SELECT statement.
- The ORDER BY clause is executed first in the query execution.
From SQLPlus, you issue this SELECT statement: SELECT From orders; You use this statement to retrieve data from a data table for __________.
- updating
- viewing
- deleting
- inserting
- truncating
Evaluate this SQL*Plus command: START delaccount Which task will this command accomplish?
- It executes the DELACCOUNT PL/SQL routine.
- It runs the DELACCOUNT.SQL script file.
- It creates the DELACCOUNT file using the default file extension.
- It invokes the editor to edit the contents of the DELACCOUNT file.
Which /SQL*Plus feature can be used to replace values in the WHERE clause?
- Substitution variables
- Replacement variables
- Prompt variables
- Instead-of variables