Chapter 2 - Basic SQL SELECT Statements

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following symbols is used for a column alias containing spaces? ' ' || " " //

" "

Which of the following symbols is used in a SELECT clause to display all columns from a table? / & * "

*

What are the guidelines to keep in mind when using a column alias?

-list the column alias next to the column name in the SELECT clause -AS "..." -If the column alias consists of only one word without special symbols, it doesn't need to be enclosed in quotation marks -

How do you indicate that a column alias should be used?

Can do 1. AS "..." OR 2. If the column alias consists of only one word without special symbols, it doesn't need to be enclosed in quotation marks.

How can you concatenate columns in a query?

Combining the contents of two or more columns is known as concatenation. To instruct Oracle 12c to concatenate the output of a query, use two vertical bars, or pipes (||), between the fields you're combining.

Which clause is required in a SELECT statement? WHERE ORDER BY GROUP BY FROM all of the above

FROM

What is a NULL value?

If no value is entered for a column in a row of data, the value is considered NULL, indicating an absence of data. If any value in an arithmetic operation is NULL, the result is NULL.

Which of the following SELECT statements returns all fields in the ORDERS table? SELECT customer#, order#, orderdate, shipped, address FROM orders; SELECT * FROM orders; SELECT ? FROM orders; SELECT ALL FROM orders;

SELECT * FROM orders;

What are the two required clauses for a SELECT statement?

SELECT and FROM

Which of the following SELECT statements displays a list of customer names from the CUSTOMERS table? SELECT customer names FROM customers; SELECT "Names" FROM customers; SELECT firstname, lastname FROM customers; SELECT firstname, lastname, FROM customers; SELECT firstname, lastname, "Customer Names" FROM customers;

SELECT firstname, lastname FROM customers;

Which of the following is not a valid SELECT statement? SELECT lastname, firstname FROM customers; SELECT * FROM orders; Select FirstName NAME from CUSTOMERS; SELECT lastname Last Name FROM customers;

SELECT lastname Last Name FROM customers; (If the column alias contains spaces or special symbols, or if you don't want it to appear in all uppercase letters, you must enclose it in quotation marks (" ").)

Which of the following is not a valid SELECT statement? SELECT cost-retail FROM books; SELECT retail+cost FROM books; SELECT retail * retail * retail FROM books; SELECT retail^3 from books;

SELECT retail^3 from books;

Which of the following is a valid SELECT statement? SELECT TITLES * TITLE! FROM BOOKS; SELECT "customer#" FROM books; SELECT title AS "Book Title" from books; all of the above

SELECT title AS "Book Title" from books;

Which of the following commands displays a listing of the category for each book in the BOOKS table? SELECT title books, category FROM books; SELECT title, books, and category FROM books; SELECT title, cat FROM books; SELECT books, | | category "Categories" FROM books;

SELECT title, cat FROM books; OR SELECT title books, category FROM books; IDK

When is it appropriate to use a column alias?

Sometimes a column name is a vague indicator of the data that's displayed.

Which of the following lines of the SELECT statement contains an error? SELECT * FROM publishers; line 1 line 2 There are no errors.

There are no errors.

Which of the following lines of the SELECT statement contains an error? SELECT ISBN, retail-cost FROM books; line 1 line 2 line 3 There are no errors.

There are no errors.

Which of the following lines of the SELECT statement contains an error? SELECT name, contact "Person to Call", phone FROM publisher; line 1 line 2 line 3 There are no errors.

There are no errors.

Which of the following lines of the SELECT statement contains an error? SELECT title, isbn, Pubdate "Date of Publication" FROM books; line 1 line 2 line 3 There are no errors.

There are no errors.

What is the purpose of a column alias?

To better describe the data displayed in the output, you can substitute a column alias for the column name in query results.

What does an asterisk (*) in the SELECT clause of a SELECT statement represent?

To have the SELECT statement return all data from a specific table, type an asterisk (*) after SELECT.

Which clause is not required in a SELECT statement? SELECT FROM WHERE All of the above clauses are required.

WHERE

What is a data dictionary?

a collection of objects the DBMS manages to maintain information about the database.

What is the purpose of the SELECT statement?

enable users to retrieve data from tables. A user can view all the fields and records in a table or specify displaying only certain fields and records. In essence, the SELECT statement asks the database a question (it's a query).

When must a comma be used in the SELECT clause of a query? when a field name is followed by a column alias to separate the SELECT clause and the FROM clause when only one field is selected It's never used in the SELECT clause. when listing more than one field name and the fields aren't concatenated when an arithmetic expression is included in the SELECT clause

when listing more than one field name and the fields aren't concatenated

Which of the following lines of the SELECT statement contains an error? SELECT ISBN, || ' is the ISBN for the book named ' || title FROM books; line 1 line 2 line 3 There are no errors.

line 1

Which of the following lines of the SELECT statement contains an error? SELECT title, category FORM books; line 1 line 2 There are no errors.

line 2

Which of the following lines of the SELECT statement contains an error? SELECT name, contact, "Person to Call", phone FROM publisher; line 1 line 2 line 3 There are no errors.

line 2

Which of the following lines of the SELECT statement contains an error? SELECT title, cost, cost*2 'With 200% Markup' FROM books; line 1 line 2 line 3 line 4 There are no errors.

line 3

Which of the following symbols represents concatenation? * || [] ' '

||


Ensembles d'études connexes

Mastering Geology: Chapter 19 Deserts and Wind

View Set

Chapter 12 business stat and opt

View Set

chapter3: early empires in the ancient near east

View Set

Learning Theory of Dance - Chapter 1

View Set

ITIS 152/CISN 342 CCNA Enterprise Networking, Security, and Automation (ENSA) Module 12: Network Troubleshooting

View Set

ATI Chapter 17 Airflow Disorders

View Set