MySQL Flashcards

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

Which SQL statement is used to extract data from a database?

A

SELECT

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

Which SQL statement is used to update data in a database?

A

UPDATE

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

Which SQL statement is used to delete data from a database?

A

DELETE

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

Which SQL statement is used to insert new data in a database?

A

INSERT INTO

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

With SQL, how do you select a column named “FirstName” from a table named “Persons”?

A

SELECT FirstName FROM Persons

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

With SQL, how do you select all the columns from a table named “Persons”?

A

SELECT * FROM Persons

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

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” is “Peter”?

A

SELECT * FROM Persons WHERE FirstName=’Peter’

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

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” starts with an “a”?

A

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

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

The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true

A

True

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

With SQL, how do you select all the records from a table named “Persons” where the “FirstName” is “Peter” and the “LastName” is “Jackson”?

A

SELECT * FROM Persons WHERE FirstName=’Peter’ AND LastName=’Jackson’

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

With SQL, how do you select all the records from a table named “Persons” where the “LastName” is alphabetically between (and including) “Hansen” and “Pettersen”?

A

SELECT * FROM Persons WHERE LastName BETWEEN ‘Hansen’ AND ‘Pettersen’

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

Which SQL statement is used to return only different values?

A

SELECT DISTINCT

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

Which SQL keyword is used to sort the result-set?

A

ORDER BY

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

With SQL, how can you return all the records from a table named “Persons” sorted descending by “FirstName”?

A

SELECT * FROM Persons ORDER BY FirstName DESC

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

With SQL, how can you insert a new record into the “Persons” table?

A

INSERT INTO Persons VALUES (‘Jimmy’, ‘Jackson’)

17
Q

With SQL, how can you insert “Olsen” as the “LastName” in the “Persons” table?

A

INSERT INTO Persons (LastName) VALUES (‘Olsen’)

18
Q

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

A

UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

19
Q

With SQL, how can you delete the records where the “FirstName” is “Peter” in the Persons Table?

A

DELETE FROM Persons WHERE FirstName = ‘Peter’

20
Q

With SQL, how can you return the number of records in the “Persons” table?

A

SELECT COUNT(*) FROM Persons