Introduction to Structured Query Language (SQL)

Introduction to Structured Query Language (SQL)

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

In an SQL query, which of the following symbols is used by ANSI SQL to represent a single unspecified character? a.) _ (underscore) b.) ? (question mark) c.) * (asterisk) d.) % (percent) e.) # (pound)

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

4 years ago

Date created

Mar 1, 2020

Cards (40)

Section 1

(40 cards)

In an SQL query, which of the following symbols is used by ANSI SQL to represent a single unspecified character? a.) _ (underscore) b.) ? (question mark) c.) * (asterisk) d.) % (percent) e.) # (pound)

Front

A) _ (underscore)

Back

One advantage of using the ALTER command to define a primary is that the database designer controls the . a.) name of the primary key b.) name of the foreign key c.) name of the constraint d.) a and b e.) a, b and c

Front

c.) name of the constraint

Back

In an SQL query, the built-in function COUNT works with columns containing data of which of the following data types? a.) Integer b.) Numeric c.) Char d.) a and b e.) a, b and c

Front

e.) a, b and c

Back

Which SQL keyword is used to change one or more rows in a table? a.) MODIFY b.) INSERT c.) SELECT d.) CHANGE e.) UPDATE

Front

e.) UPDATE

Back

In an SQL query, which built-in function is used to total numeric columns? a.) AVG b.) COUNT c.) MAX d.) MEAN e.) SUM

Front

e.) SUM

Back

Regarding the interchangeability of subqueries and joins . a.) A join can always be used as an alternative to a subquery, and a subquery can always be used as an alternative to a join. b.) A join can sometimes be used as an alternative to a subquery, and a subquery can sometimes be used as an alternative to a join. c.) A join can always be used as an alternative to a subquery, and a subquery can sometimes be used as an alternative to a join. d.) A join can sometimes be used as an alternative to a subquery, and a subquery can always be used as an alternative to a join. e.) A join can never be used as an alternative to a subquery, and a subquery can never be used as an alternative to a join.

Front

b.) A join can sometimes be used as an alternative to a subquery, and a subquery can sometimes be used as an alternative to a join.

Back

In an SQL query, which built-in function is used to compute the number of rows in a table? a.) AVG b.) COUNT c.) MAX d.) MIN e.) MEAN

Front

b.) COUNT

Back

Given a table with the structure: EMPLOYEE (EmpNo, Name, Salary, HireDate), which of the following is not a valid ANSI SQL command? a.) SELECT * FROM EMPLOYEE WHERE Name LIKE 'Ja%'; b.) SELECT COUNT(*) FROM EMPLOYEE WHERE Salary < 30000; c.) SELECT COUNT(EmpNo) FROM EMPLOYEE; d.) SELECT HireDate, COUNT(*) FROM EMPLOYEE WHERE Salary < 30000; e.) SELECT HireDate, COUNT(*) FROM EMPLOYEE GROUP BY HireDate;

Front

d.) SELECT HireDate, COUNT(*) FROM EMPLOYEE WHERE Salary < 30000;

Back

In an SQL query, which built-in function is used to compute the average value of numeric columns? a.) AVG b.) MEAN c.) MAX d.) MIN e.) SUM

Front

a.) AVG

Back

In an SQL query, which SQL keyword is used with GROUP BY to select groups meeting specified criteria? a.) AND b.) EXISTS c.) HAVING d.) IN e.) WHERE

Front

c.) HAVING

Back

Which SQL keyword is used to name a new table and describe the table's columns? a.) SET b.) CREATE c.) SELECT d.) ALTER e.) MODIFY

Front

b.) CREATE

Back

Which SQL keyword is used to change the structure, properties or constraints of a table? a.) SET b.) CREATE c.) SELECT d.) ALTER e.) MODIFY

Front

d.) ALTER

Back

When the correct SQL command is used to delete a table's structure, what happens to the data in the table? a.) If the deleted table was a parent table, the data is added to the appropriate rows of the child table. b.) If the deleted table was a child table, the data is added to the appropriate rows of the parent table. c.) The data in the table is also deleted. d.) Nothing because there was no data in the table - only an empty table can be deleted. e.) a and b

Front

c.) The data in the table is also deleted.

Back

In an SQL query, which SQL keyword is used to specify the names of tables to be joined? a.) FROM b.) HAVING c.) JOIN d.) SELECT e.) WHERE

Front

a.) FROM

Back

Which SQL keyword is used to change a column value? a.) CHANGE b.) INSERT c.) SELECT d.) SET e.) MODIFY

Front

d.) SET

Back

Based on the tables above, which of the following ANSI SQL commands would return the average customer balance grouped by SalesRepNo? a.) SELECT AVG (Balance) FROM CUSTOMER WHERE SalesRepNo; b.) SELECT AVG (Balance) FROM CUSTOMER GROUP BY SalesRepNo; c.) SELECT AVG (Balance) FROM CUSTOMER, SALESREP WHERE SALESREP.SalesRepNo = CUSTOMER.SalesRepNo; d.) SELECT AVG (Balance) FROM CUSTOMER ORDER BY SalesRepNo; e.) SELECT AVG (Balance) FROM CUSTOMER, SALESREP WHERE CUSTOMER.SalesRepNo = CUSTOMER.SalesRepNo HAVING SalesRepNo;

Front

b.) SELECT AVG (Balance) FROM CUSTOMER GROUP BY SalesRepNo;

Back

Based on the tables above, which of the following commands in ANSI SQL would return only the name of the sales representative and name of the customer for each customer that has a balance greater than 400? a.) SELECT * FROM SALESREP, CUSTOMER WHERE Balance > 400; b.) SELECT DISTINCT RepName, CustName FROM SALESREP, CUSTOMER WHERE Balance > 400; c.) SELECT * FROM SALESREP, CUSTOMER WHERE SALESREP.SalesRepNo = CUSTOMER.SalesRepNo AND Balance > 400; d.) SELECT RepName, CustName FROM SALESREP, CUSTOMER WHERE SALESREP.SalesRepNo = CUSTOMER.SalesRepNo AND Balance > 400; e.) SELECT RepName, CustName FROM SALESREP, CUSTOMER WHERE Balance > 400 GROUP BY SalesRepNo;

Front

d.) SELECT RepName, CustName FROM SALESREP, CUSTOMER WHERE SALESREP.SalesRepNo = CUSTOMER.SalesRepNo AND Balance > 400;

Back

Which of the following illustrates the author's preferred style of defining a primary key? a.) CREATE TABLE CUSTOMER ( CustomerID Integer Primary Key LastName Char(35) Not Null First Name Char(25) Null): b.) CREATE TABLE CUSTOMER ( CustomerID Integer Not Null LastName Char(35) Not Null First Name Char(25) Null CONSTRAINT CustomerPK PRIMARY KEY (CustomerID); c.) CREATE TABLE CUSTOMER ( CustomerID Integer Not Null LastName Char(35) Not Null First Name Char(25) Null): ALTER TABLE CUSTOMER ADD CONSTRAINT CustomerPK PRIMARY KEY (CustomerID); d.) either b or c e.) Te author does not state a preference for how to define a primary key.

Front

b.) CREATE TABLE CUSTOMER ( CustomerID Integer Not Null LastName Char(35) Not Null First Name Char(25) Null CONSTRAINT CustomerPK PRIMARY KEY (CustomerID);

Back

Which SQL keyword is used to add one or more rows to a table? a.) DELETE b.) INSERT c.) SELECT d.) SET e.) UPDATE

Front

b.) INSERT

Back

In an SQL query, which SQL keyword is used to state the condition that specifies which rows are to be selected? a.) EXISTS b.) FROM c.) SELECT d.) SET e.) WHERE

Front

e.) WHERE

Back

In an SQL query, which SQL keyword must be used to remove duplicate rows from the result table? a.) DELETE b.) DISTINCT c.) NOT EXISTS d.) UNIQUE e.) KEY

Front

b.) DISTINCT

Back

SQL is a(n) . a.) data sublanguage b.) product of IBM research c.) national standard d.) combination of a data definition language and a data manipulation language e.) All of the above.

Front

e.) All of the above.

Back

In an SQL query, which built-in function is used to obtain the smallest value of numeric columns? a.) AVG b.) COUNT c.) MAX d.) MIN e.) SUM

Front

d.) MIN

Back

All constraints are stored in . a.) the parent table b.) the child table c.) an intersection table d.) the database metadata e.) a and b

Front

d.) the database metadata

Back

In an SQL query, which SQL keyword is used to implement a subquery? a.) GROUP BY b.) HAVING c.) ORDER BY d.) SELECT e.) SORT BY

Front

d.) SELECT

Back

If the table PRODUCT has a column PRICE that has the data type Numeric (8,2), the values stored for this attribute will be stored . a.) as eight digits, a decimal point, and two more digits b.) as six digits, a decimal point, and two more digits c.) as ten digits with no stored decimal point d.) as eight digits with no stored decimal point e.) as six digits with no stored decimal point

Front

d.) as eight digits with no stored decimal point

Back

Which keyword is used to remove one or more rows from a table? a.) DELETE b.) INSERT c.) ERASE d.) SET e.) UPDATE

Front

a.) DELETE

Back

Based on the tables above, which of the following commands in ANSI SQL would increase the balance of the Gonzales by $100 to a total of $450? a.) SELECT Gonzales FROM CUSTOMER INSERT VALUES PLUS (100) INTO Balance; b.) SELECT Gonzales FROM CUSTOMER INSERT VALUES (450) INTO Balance; c.) INSERT INTO CUSTOMER VALUES PLUS (100) SELECT Balance WHERE CustName = 'Gonzales'; d.) INSERT INTO CUSTOMER VALUES (450) SELECT Balance WHERE CustName = 'Gonzales'; e.) UPDATE CUSTOMER SET Balance = 450 WHERE CustName = ''Gonzales';

Front

e.) UPDATE CUSTOMER SET Balance = 450 WHERE CustName = ''Gonzales';

Back

Given a table with the structure: EMPLOYEE (EmpNo, Name, Salary, HireDate), which of the following would find all employees whose name begins with the letter "S?" a.) SELECT * FROM EMPLOYEE WHERE Name IN ['S']; b.) SELECT EmpNo FROM EMPLOYEE WHERE Name LIKE 'S'; c.) SELECT * FROM Name WHERE EMPLOYEE LIKE 'S*'; d.) SELECT * FROM EMPLOYEE WHERE Name LIKE 'S%'; e.) None of the above.

Front

d.) SELECT * FROM EMPLOYEE WHERE Name LIKE 'S%';

Back

In an SQL query, which SQL keyword is used with built-in functions to group together rows that have the same value in a specified column? a.) GROUP BY b.) ORDER BY c.) SELECT d.) SORT BY e.) DISTINCT SET

Front

a.) GROUP BY

Back

In an SQL query, which built-in function is used to obtain the largest value of numeric columns? a.) AVG b.) COUNT c.) MAX d.) MIN e.) SUM

Front

c.) MAX

Back

In an SQL query, which SQL keyword is used to join two conditions that both must be true for the rows to be selected? a.) AND b.) EXISTS c.) HAVING d.) IN e.) OR

Front

a.) AND

Back

In an SQL query, which SQL keyword is used to specify the condition(s) for a join operation? a.) FROM b.) HAVING c.) JOIN d.) SELECT e.) WHERE

Front

e.) WHERE

Back

In an SQL query, which SQL keyword is used to sort the result table by the values in one or more columns? a.) GROUP BY b.) ORDER BY c.) SELECT d.) SORT BY e.) WHERE

Front

b.) ORDER BY

Back

In an SQL query, which SQL keyword is used to determine if a column value is equal to any one of a set of values? a.) AND b.) EXISTS c.) HAVING d.) IN e.) OR

Front

d.) IN

Back

Which SQL keyword is used to delete a table's structure? a.) DELETE b.) DROP c.) DISPOSE d.) ALTER e.) MODIFY

Front

b.) DROP

Back

In an SQL query, which SQL keyword is used to specify the table(s) to be used? a.) EXISTS b.) FROM c.) SELECT d.) SET e.) WHERE

Front

b.) FROM

Back

In an SQL query of two tables, which SQL keyword indicates that we want data from all the rows of one table to be included in the result, even if the row does not correspond to any data in the other table? a.) LEFT JOIN b.) RIGHT JOIN c.) INCLUDE d.) a and b e.) a, b and c

Front

d.) a and b

Back

If the table PRODUCT has a column PRICE that has the data type Numeric (8,2), the value 12345 will be displayed by the DBMS as . a.) 123.45 b.) 12345 c.) 12345.00 d. 123450.00 e.) 00012345

Front

a.) 123.45

Back

When one SQL query is embedded in the WHERE clause of another SQL query, this is referred to as a __________. a.) subset b.) join c.) WHERE Query d.) subquery e.) set query

Front

d.) subquery

Back