Tap an option to check your answer — the correct answer and full explanation appear after you choose.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-507
Which SQL clause is used to filter rows in a table?
AORDER BY.
BGROUP BY.
CWHERE. ✓ Correct answer
DSELECT.
✓ Correct answer: WHERE.
Full explanation
WHERE. is the SQL clause used to filter rows in a table, because the WHERE clause picks out only the rows that meet a condition. Why the others are wrong: ORDER BY. - ORDER BY is used to sort rows, not to filter them; GROUP BY. - GROUP BY is used to group rows, not to filter them; SELECT. - SELECT is used to get data from a table, not to filter rows.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-530
Which SQL clause is used to group rows that have the same values?
AORDER BY
BGROUP BY ✓ Correct answer
CSELECT
DFROM
✓ Correct answer: GROUP BY
Full explanation
GROUP BY. The GROUP BY clause groups rows that have the same values so that a function can be applied to each group. Why the others are wrong: ORDER BY — ORDER BY sorts rows, it does not group them. SELECT — SELECT chooses columns, it does not group rows. FROM — FROM names the table, it does not group rows.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-553
Which SQL command is used to delete a whole database?
ADELETE DATABASE.
BREMOVE DATABASE.
CDROP DATABASE. ✓ Correct answer
DERASE DATABASE.
✓ Correct answer: DROP DATABASE.
Full explanation
DROP DATABASE. is the SQL command used to delete a whole database. Why the others are wrong: DELETE DATABASE. — DELETE removes rows from a table, it does not delete a whole database. REMOVE DATABASE. — REMOVE is not an SQL command. ERASE DATABASE. — ERASE is not an SQL command.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-576
A database administrator wants to delete an entire table, with all its rows and its structure, from a database. Which SQL command does this job?
ADROP TABLE ✓ Correct answer
BDELETE TABLE
CREMOVE TABLE
DERASE TABLE
✓ Correct answer: DROP TABLE
Full explanation
The answer is DROP TABLE. The DROP TABLE command removes the whole table, including its structure and all its data, from the database. Why the others are wrong: DELETE TABLE — DELETE is used to remove rows from a table, and there is no DELETE TABLE command. REMOVE TABLE — there is no REMOVE TABLE command in SQL. ERASE TABLE — there is no ERASE TABLE command in SQL.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-599
Which SQL clause is used to sort the results of a query?
AWHERE.
BGROUP BY.
CHAVING.
DORDER BY. ✓ Correct answer
✓ Correct answer: ORDER BY.
Full explanation
ORDER BY. sorts the results of a query, for example ORDER BY name arranges rows alphabetically by name. Why the others are wrong: "WHERE." filters rows before they are returned, it does not sort them. "GROUP BY." groups rows that have the same values, it does not sort them. "HAVING." filters groups after grouping, it does not sort them.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-622
Which SQL command is used to save the changes made to a database?
ACOMMIT. ✓ Correct answer
BSAVE.
CSTORE.
DKEEP.
✓ Correct answer: COMMIT.
Full explanation
The correct answer is COMMIT. In SQL, COMMIT is the command that saves the changes made to a database. Why the others are wrong: SAVE. — it is not a SQL command for saving changes. STORE. — it is not a SQL command for saving changes. KEEP. — it is not a SQL command for saving changes.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-645
Which SQL statement is used to change data already stored in a table?
ASELECT.
BINSERT.
CUPDATE. ✓ Correct answer
DDELETE.
✓ Correct answer: UPDATE.
Full explanation
UPDATE. UPDATE. is the SQL statement used to change data already stored in a table. Why the others are wrong: SELECT. — SELECT. reads data from a table, it does not change it.. INSERT. — INSERT. adds new rows to a table, it does not change old rows.. DELETE. — DELETE. removes rows from a table, it does not change them..
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-668
Which SQL keyword is used to sort results in order?
AORDER BY. ✓ Correct answer
BGROUP BY.
CSORT BY.
DFILTER BY.
✓ Correct answer: ORDER BY.
Full explanation
In SQL, the ORDER BY keyword sorts the rows returned by a query into order, so the correct answer is ORDER BY. Why the others are wrong: GROUP BY. — GROUP BY groups rows that have the same values, it does not sort them. SORT BY. — SORT BY is not a standard SQL keyword. FILTER BY. — FILTER BY is not a standard SQL keyword.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-691
Which SQL command is used to add a new column to an existing table?
AUPDATE.
BINSERT.
CCREATE TABLE.
DALTER TABLE. ✓ Correct answer
✓ Correct answer: ALTER TABLE.
Full explanation
ALTER TABLE. The ALTER TABLE command changes the structure of an existing table, such as adding a new column. Why the others are wrong: UPDATE. — UPDATE changes the data in rows, not the columns of a table. INSERT. — INSERT adds a new row of data, not a new column. CREATE TABLE. — CREATE TABLE makes a whole new table, it does not change an existing one.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-714
Which SQL clause groups rows that share the same values in a column?
AORDER BY
BWHERE
CGROUP BY ✓ Correct answer
DHAVING
✓ Correct answer: GROUP BY
Full explanation
GROUP BY. The GROUP BY clause groups rows that share the same values in a column, so they can be counted or totalled together. Why the others are wrong: ORDER BY — ORDER BY sorts the results, it does not group rows. WHERE — WHERE filters rows before grouping, it does not group them. HAVING — HAVING filters groups after grouping, it does not group the rows itself.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-737
Which SQL keyword removes duplicate rows from the result of a query?
AORDER BY
BUNIQUE
CDISTINCT ✓ Correct answer
DGROUP BY
✓ Correct answer: DISTINCT
Full explanation
The DISTINCT keyword removes duplicate rows from the result of a query. The answer is DISTINCT. Why the others are wrong: UNIQUE — UNIQUE is a rule for a column, not a keyword that removes duplicate rows from a result. ORDER BY — ORDER BY sorts the result, it does not remove duplicates. GROUP BY — GROUP BY groups rows that have the same values, it does not remove duplicate rows from a plain result.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-783
Which SQL clause is used to arrange the results in order?
AGROUP BY
BWHERE
CDELETE
DORDER BY ✓ Correct answer
✓ Correct answer: ORDER BY
Full explanation
The correct answer is ORDER BY. The ORDER BY clause is used to arrange the results in order. Why the others are wrong: GROUP BY — GROUP BY groups rows with the same values, it does not arrange results in order. WHERE — WHERE picks which rows to show, it does not arrange results in order. DELETE — DELETE removes rows, it does not arrange results in order.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-806
Which SQL command is used to show the names of all the tables in a database?
ASELECT
BINSERT
CDELETE
DSHOW TABLES ✓ Correct answer
✓ Correct answer: SHOW TABLES
Full explanation
The command used to show the names of all the tables in a database is SHOW TABLES. Why the others are wrong: SELECT — SELECT is used to get data from a table, not to list tables. INSERT — INSERT is used to add new data, not to list tables. DELETE — DELETE is used to remove data, not to list tables.
Computer ScienceSQLCSSPPSCFPSCNTSID: CMP-829
In SQL, what does the HAVING clause do?
AIt creates a new table
BIt deletes a whole database
CIt sorts rows in order
DIt filters groups of rows after they are grouped ✓ Correct answer
✓ Correct answer: It filters groups of rows after they are grouped
Full explanation
It filters groups of rows after they are grouped. HAVING works like WHERE, but it filters groups made by GROUP BY instead of single rows. Why the others are wrong: It creates a new table — a new table is created with CREATE TABLE, not HAVING. It deletes a whole database — a database is deleted with DROP DATABASE, not HAVING. It sorts rows in order — rows are sorted with ORDER BY, not HAVING.
Computer ScienceSQLPPSCID: PPP-136
Which of the following is NOT a valid keyword in SQL?
ADelete
BInsert
CUpdate
DSubmit ✓ Correct answer
✓ Correct answer: Submit
Full explanation
Delete, Insert and Update are SQL keywords, while Submit is not, so the correct answer is Submit.
Computer ScienceSQLBPSCID: BPP-916
Which SQL aggregate function ignores NULL values?
AMax()
BSum()
CAvg()
DAll of them ✓ Correct answer
✓ Correct answer: All of them
Full explanation
All of them. The SQL aggregate functions MAX(), SUM() and AVG() all ignore NULL values; only non-NULL values are considered in the calculation.
Computer ScienceSQLBPSCID: BPP-2129
The query create index belongs to which of the following
ASQL
BPL/SQL
CDDL ✓ Correct answer
DDML
✓ Correct answer: DDL
Full explanation
CREATE INDEX is a data definition statement, so it belongs to DDL.
Computer ScienceSQLBPSCID: BPP-2744
The full form of SQL is:
AStructured Query Language ✓ Correct answer
BStandard Query Language
CSimple Query Language
DSequential Query Language
✓ Correct answer: Structured Query Language
Full explanation
The full form of SQL is Structured Query Language.
Computer ScienceSQLBPSCID: BPP-2745
Which SQL command retrieves data from a database?
AINSERT
BSELECT ✓ Correct answer
CUPDATE
DDELETE
✓ Correct answer: SELECT
Full explanation
The SELECT command retrieves data from a database.
Computer ScienceSQLBPSCID: BPP-2746
Which SQL command is used to insert data into a table?
AUPDATE
BCREATE
CINSERT ✓ Correct answer
DSELECT
✓ Correct answer: INSERT
Full explanation
The INSERT command is used to insert data into a table.