L508 PRACTICE QUIZ 4
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
Which of the following is used to delete an existing table in SQL?
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
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 change the value of a specific column in a row?
UPDATE table_name SET column_name = value WHERE condition;
Which SQL data type is used to store large text or character data?
VARCHAR
Which SQL data type is used to store variable-length character strings?
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 rows in a SELECT statement 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
Which of the following is NOT a valid SQL data type?
STRING
In SQL, which command is used to remove all records from a table without removing the table itself?
TRUNCATE TABLE
In SQL, what is the purpose of the JOIN clause?
To combine rows from multiple tables based on related columns.
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.
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 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, ...);
In SQL, which command is used to remove records from a table?
DELETE
Which SQL statement is used to permanently delete all rows from a table?
DELETE
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
In SQL, which command is used to remove a table from a database?
DROP
Which clause is used in SQL to specify the columns to be returned by a query?
SELECT
Which SQL statement is used to delete a specific row from a table?
DELETE FROM table_name WHERE condition;
In SQL, what does the term "foreign key" refer to?
A column or set of columns that establishes a link between two tables.
What is the result of the following SQL query: SELECT FirstName, LastName FROM Employees WHERE Department = 'HR' AND Salary > 50000;
A list of first and last names of employees in the HR department who earn more than 50,000.
In SQL, which command is used to change the structure of a table, such as adding or deleting columns?
ALTER TABLE
Which SQL command is used to add a column to an existing table?
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 remove a column from an existing table?
ALTER TABLE DROP COLUMN
How do you add a new column to an existing table in a MySQL database?
ALTER TABLE table_name ADD COLUMN column_name data_type;
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 data type in MySQL is used to store variable-length binary data, such as images or files?
BLOB
Which of the following SQL data types is used to store binary data?
BLOB
Which data type is used to store fixed-length character strings in MySQL?
CHAR
Which SQL clause is used to group rows that have the same values in specified columns?
GROUP BY
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
Which SQL command is used to add a new record to a table?
INSERT
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 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 SQL clause is used to filter the results of a query based on a condition?
ORDER BY
Which clause is used in SQL to specify the order in which the results of a query should be returned?
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