Databases - MYSQL Flashcards
Which three commands are used to make changes to data within a database?
- INSERT
- UPDATE
- DELETE
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 |
———————————————————————————–
SELECT ClientFirstName FROM tbl_clients WHERE ClientFirstName LIKE ‘a%’;
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 |
——————————————————————–
SELECT ContenderName FROM tbl_contenders ORDER BY FoodEaten DESC LIMIT 2;
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 |
———————————————————————————–
INSERT INTO tbl_clients (ClientFirstName, ClientLastName, ClientAge) VALUES (‘Max’, ‘Monkey’, 22);
List a situation where you would need to use the ALTER DDL command.
When modifications to the structure of a table or database is needed.