508 Quiz 4
Which SQL command is used to remove a table and all of its data from a database?
DROP TABLE
Which SQL statement is used to delete a table structure and its data permanently?
DROP TABLE
Which SQL statement is used to remove a table from a database?
DROP TABLE
Which SQL statement is used to permanently remove a table from a database, but only if it exists?
DROP TABLE IF EXISTS
Which of the following SQL statements is used to remove an existing table and its data from a database?
DROP TABLE IF EXISTS
What does DDL stand for in the context of SQL?
Data Definition Language
Which SQL clause is used to specify the table from which to select or delete data?
FROM
Which clause is used in SQL to specify the table from which to retrieve data?
FROM
In SQL, which type of JOIN returns all records when there is a match in either the left or the right table?
FULL OUTER JOIN
Which SQL statement is used to modify existing data in a table?
UPDATE table_name SET column_name = value WHERE condition;
In MySQL, which data type is used to store variable-length character strings?
VARCHAR
Which SQL data type is used to store variable-length character strings?
VARCHAR
Which SQL data type should be used to store a customer's email address?
VARCHAR
Which data type should be used to store a customer's phone number in a MySQL database?
VARCHAR
What SQL clause is used to filter the results of a query?
WHERE
Which SQL clause is used to filter the results of a query based on a condition?
WHERE
Which SQL clause is used to filter the results of a query based on a specified condition?
WHERE
Which SQL clause is used to specify a condition that must be met for a row to be included in the results of a query?
WHERE
Which clause is used in SQL to filter the results returned by a query?
WHERE
In SQL, which command is used to remove all records from a table without removing the table itself?
TRUNCATE TABLE
What is the purpose of the DISTINCT keyword in a SQL query?
To eliminate duplicate rows from the result set.
What is the primary purpose of the HAVING clause in a SQL query?
To filter groups of rows based on a condition.
What is the primary purpose of the WHERE clause in a SQL query?
To filter rows based on a condition.
In SQL, what is the purpose of the LIMIT clause?
To limit the number of rows returned in the result set.
What is the purpose of the ORDER BY clause in a SQL query?
To sort the result set.
What is the purpose of a primary key in a relational database table?
To uniquely identify each row in the table.
In SQL, which command is used to modify the data in a table based on a condition?
UPDATE
Which SQL statement is used to change data in existing rows of a table?
UPDATE
Which SQL statement is used to update data in a database table?
UPDATE
Which clause would you use in SQL to change the data in an existing row?
UPDATE
Which of the following SQL statements is used to change data in an existing row?
UPDATE
Which data type is used to store fixed-length character strings in MySQL?
CHAR
Which SQL command is used to create a new table in a database?
CREATE TABLE
Which of the following SQL statements is used to create a new table?
CREATE TABLE
Which SQL statement is used to create a copy of an existing table with the same data and structure?
CREATE TABLE AS
How do you create a new table in a database?
CREATE TABLE table_name (column1 data_type, column2 data_type, ...);
Which of the following SQL data types is used to store date and time values?
DATETIME
Which of the following SQL statements is used to delete rows from a table?
DELETE
Which of the following SQL statements is used to delete specific rows from a table based on a condition?
DELETE
How can you delete all rows from a table without deleting the table itself?
DELETE FROM table_name
How can you select all columns from a table?
SELECT *
Which SQL statement is used to delete a specific row from a table?
DELETE FROM table_name WHERE condition;
In SQL, which command is used to change the structure of a table, such as adding or deleting columns?
ALTER TABLE
Which of the following SQL statements is used to change the structure of an existing table?
ALTER TABLE
Which of the following SQL statements is used to add a new column to an existing table?
ALTER TABLE ADD COLUMN
Which of the following SQL statements is used to remove a column from an existing table?
ALTER TABLE DROP COLUMN
Which SQL statement is used to add a primary key to a table?
ALTER TABLE table_name ADD PRIMARY KEY (column_name);
How do you rename a column in a MySQL database table?
ALTER TABLE table_name CHANGE old_column_name new_column_name data_type
Which SQL statement is used to remove a column from a table?
ALTER TABLE table_name DROP COLUMN column_name
What is the default sorting mode of the ORDER BY clause in SQL?
Ascending
Which SQL data type is used to store a fixed amount of binary data, such as images or files?
BLOB
Which of the following SQL data types is used to store binary data?
BLOB
Which of the following SQL clauses is used to group rows that have the same values in specified columns into aggregated data, like sum or average?
GROUP BY
In SQL, which type of JOIN returns only the records with matching values in both tables?
INNER JOIN
Which SQL statement is used to add a new row to a database table?
INSERT INTO
Which SQL statement is used to add new data into an existing table?
INSERT INTO
Which SQL statement is used to add a new row to a table?
INSERT INTO table_name (column_name) VALUES (value);
Which of the following is a valid SQL data type used to store whole numbers?
INT
In SQL, which clause is used to combine rows from two or more tables based on a related column between them?
JOIN
Which of the following SQL clauses is used to combine rows from two or more tables based on a related column?
JOIN
Which JOIN type returns all records from the left table and the matched records from the right table, and NULL for every column from the right table that does not have a matching record in the left table?
LEFT JOIN
In SQL, which clause is used to restrict the results of a JOIN operation based on a condition?
ON
Which SQL clause is used to sort the results of a query?
ORDER BY
Which of the following SQL clauses is used to sort the results of a query in descending order?
ORDER BY DESC
What does the SELECT statement in SQL primarily do?
Retrieves data from a table.
Which SQL clause is used to specify the columns to be retrieved in a query?
SELECT