Structured Query Language
Querying The Database
Now that you have a table full of data, it's time to do some queries. The only main difference between the types of SELECT query that you have done with Access and those you do in MySQL is the format for LIKE clauses. In MySQL, the wildcard character is %. If you are unsure how to do this, choose the Query By Design option in PHPMyAdmin. PHPMyAdmin helpfully shows the SQL for any of the operations that you perform through the software.
Create SQL SELECT queries to do the following,
- Which of the seeds cost less than £15?
- Which of the seeds costing under £15 have more than 200 seeds per gram?
- Which of the seeds can be planted in open ground?
- Which of the seeds produce flowers in January, February or March?
- Which of the seeds need to be planted in April and cost less than £10?
- Which of the seeds produce plants with blue flowers?
- Which of the seeds produce plants with green leaves?
- Which of the seeds produce plants with dark green leaves?
- Which of the seeds produce hardy plants?
- Which of the plants are annual?
- Which of the plants are perennial?
- Produce a list of unique seed types in the table.