Which SQL statement is used to retrieve data from a MySQL table?
A
FETCH B
SELECT C
GET D
SHOW
Analysis & Theory
The SELECT statement is used to retrieve data from a database table in MySQL.
What does the asterisk (*) mean in a SELECT statement?
A
Multiply all columns B
Select columns starting with * C
Select all columns D
Delete all columns
Analysis & Theory
The * symbol is used to select all columns in the table.
What is the correct syntax to select the `name` and `age` columns from a table named `users`?
A
SELECT name AND age FROM users; B
SELECT (name, age) FROM users; C
SELECT name, age FROM users; D
GET name, age FROM users;
Analysis & Theory
The correct SQL syntax is: SELECT name, age FROM users;
How do you select only distinct values from a column in MySQL?
A
SELECT UNIQUE column FROM table; B
SELECT DISTINCT column FROM table; C
SELECT column ONLY FROM table; D
SELECT column FROM table UNIQUE;
Analysis & Theory
The DISTINCT keyword is used in SELECT statements to return only unique values.
Which clause is used with SELECT to filter the results?
A
HAVING B
ORDER BY C
GROUP BY D
WHERE
Analysis & Theory
The WHERE clause is used to filter rows based on a specific condition.
Which clause is used to sort the result of a SELECT query?
A
GROUP BY B
SORT BY C
ORDER BY D
FILTER BY
Analysis & Theory
ORDER BY is used to sort the output of a SELECT query in ascending or descending order.
What does the LIMIT clause do in a SELECT query?
A
Sort the results B
Count the number of columns C
Restrict the number of returned rows D
Remove duplicates
Analysis & Theory
LIMIT restricts the number of rows returned by the SELECT query.
Which SQL keyword is used to rename a column in the SELECT output?
A
AS B
RENAME C
CHANGE D
MODIFY
Analysis & Theory
The AS keyword is used to assign an alias (temporary name) to a column in the result set.
What will `SELECT COUNT(*) FROM students;` return?
A
Sum of student ages B
Total number of students C
First student's ID D
Total number of columns
Analysis & Theory
COUNT(*) returns the total number of rows in the `students` table.
Which SQL keyword is used to combine rows from two or more tables in a SELECT query?
A
COMBINE B
GROUP C
UNION D
JOIN
Analysis & Theory
JOIN is used to combine rows from two or more tables based on a related column.