Clauses, Queries, And Syntax Flashcards

(47 cards)

1
Q

What does SQL stand for?

A

Structured Query Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: SQL is a programming language.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of the SELECT statement in SQL?

A

To retrieve data from a database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: The SQL clause that specifies the table to query is called ____.

A

FROM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which SQL clause is used to filter records?

A

WHERE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What keyword is used to sort the result set in SQL?

A

ORDER BY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False: The GROUP BY clause is used to arrange identical data into groups.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the HAVING clause do in SQL?

A

It filters records after grouping.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the default sorting order of the ORDER BY clause?

A

Ascending

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which SQL function is used to count the number of rows?

A

COUNT()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What keyword is used to add new records to a table?

A

INSERT INTO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Fill in the blank: To modify existing records in a table, you use the ____ statement.

A

UPDATE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the DELETE statement do in SQL?

A

Removes records from a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: The SQL statement ‘SELECT * FROM table_name’ retrieves all columns from a table.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of the DISTINCT keyword in SQL?

A

To return only unique values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Fill in the blank: In SQL, a ____ is a set of data stored in a table.

A

record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the primary key in a database?

A

A unique identifier for a record in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What SQL clause is used to combine records from two or more tables?

A

JOIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which type of JOIN returns all records from both tables, with matches where available?

A

FULL OUTER JOIN

20
Q

What is the purpose of the LIMIT clause in SQL?

A

To specify the maximum number of records to return.

21
Q

True or False: SQL supports both single-line and multi-line comments.

22
Q

What is the syntax to create a new table in MySQL?

A

CREATE TABLE table_name (column1 datatype, column2 datatype, …);

23
Q

Fill in the blank: The SQL function ____ is used to find the highest value in a column.

24
Q

What does the SQL command ‘ALTER TABLE’ do?

A

Modifies an existing table structure.

25
Which SQL clause is used to specify a condition for an aggregate function?
HAVING
26
What is the syntax to drop a table in MySQL?
DROP TABLE table_name;
27
True or False: The LIKE operator is used for pattern matching in SQL.
True
28
What does the SQL function SUM() do?
Calculates the total sum of a numeric column.
29
Fill in the blank: The ____ operator is used to filter records based on multiple conditions.
AND
30
What is the purpose of the UNION operator in SQL?
To combine the results of two or more SELECT statements.
31
Which SQL clause is used to specify the columns to be returned?
SELECT
32
What does the COUNT(DISTINCT column_name) function do?
Counts the number of unique values in a column.
33
True or False: An SQL view is a virtual table based on the result of a SELECT query.
True
34
What is the purpose of the CASE statement in SQL?
To create conditional logic within queries.
35
Fill in the blank: The SQL command to rename a column is ____.
ALTER TABLE ... CHANGE
36
What does the INNER JOIN do?
Returns records that have matching values in both tables.
37
Which clause is used to remove duplicates from the result set?
DISTINCT
38
What is a foreign key?
A field in one table that uniquely identifies a row of another table.
39
True or False: The SQL command 'SELECT NULL' retrieves records with null values.
False
40
What is the purpose of the AUTO_INCREMENT attribute in MySQL?
To automatically generate a unique value for a new record.
41
Fill in the blank: The SQL function ____ is used to find the smallest value in a column.
MIN()
42
Which SQL function can be used to concatenate strings?
CONCAT()
43
What is the purpose of the TRUNCATE TABLE command?
To delete all records in a table without removing the table itself.
44
True or False: SQL can only be used with relational databases.
False
45
What does the SQL command 'EXPLAIN' do?
Provides information about how MySQL executes a statement.
46
Fill in the blank: The SQL statement to create an index is ____.
CREATE INDEX
47
What is the purpose of the COALESCE function in SQL?
To return the first non-null value in a list.