Databases - MYSQL Flashcards

1
Q

Which three commands are used to make changes to data within a database?

A
  • INSERT
  • UPDATE
  • DELETE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write an SQL query to return everyone’s first name which begins with ‘a’ from table ‘tbl_clients’.

ClientID | ClientFirstName | ClientLastName | ClientAge |
| 1 | Mike | Ash | 42 |
| 2 | Abraham | Alabama | 12 |
| 3 | Archie | Jake | 16 |
| 4 | Lewis | Stewie | 30 |
| 5 | Jessica | Chan | 2 |
———————————————————————————–

A

SELECT ClientFirstName FROM tbl_clients WHERE ClientFirstName LIKE ‘a%’;

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

Write an SQL query to return the top 2 contenders in the contest.

ContenderID | ContenderName | FoodEaten |
| 1 | Joe | 16 |
| 2 | Boaz | 42 |
| 3 | James | 99 |
| 4 | William | 27 |
| 5 | Jessica | 2 |
——————————————————————–

A

SELECT ContenderName FROM tbl_contenders ORDER BY FoodEaten DESC LIMIT 2;

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

Add the following data to the following table:

First Name: Max
Last Name: Monkey
Age: 22

ClientID | ClientFirstName | ClientLastName | ClientAge |
| 1 | Mike | Ash | 42 |
| 2 | Abraham | Alabama | 12 |
| 3 | Archie | Jake | 16 |
| 4 | Lewis | Stewie | 30 |
| 5 | Jessica | Chan | 2 |
———————————————————————————–

A

INSERT INTO tbl_clients (ClientFirstName, ClientLastName, ClientAge) VALUES (‘Max’, ‘Monkey’, 22);

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

List a situation where you would need to use the ALTER DDL command.

A

When modifications to the structure of a table or database is needed.

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