A car showroom needs a database to help track stock. Here is a sample of a proposed design.
Wouldn't it be great if we could analyse a table to the number of records that are red cars or count how many of each color of car is in the database eg:
We can see here that each record is grouped by color and a count of each color is included in the query result.
Download the csv file about peripheral devices. Save it in a project folder.
Import the data into a XAMPP database table.
Remember to ask yourself a couple of questions:
Design-Test-Redesign the following queries. Paste your solutions into your worksheet where indicated.
Hint! Your queries should produce the same number of records as indicated.
| this query groups by model and shows a count of all models with the word Micro in it. | 70 records |
| this query groups by color and shows a count of all white, silver or gold Micro models priced between 8000 and 10000 inclusive. | gold 3, silver 3, white 4 |
| this query groups by date and shows a count of all cars sold between January 11 and January 15 inclusive, sorted in ascending order of date. | Jan 11 - 9; Jan 12 - 9; Jan 13 - 4; Jan 14 - 1; Jan 15 - 1; |
Use the data from the third query to create a bar chart showing the number of sales for the 5 dates.
it should look like the following. Note the differences:
Queries are very smart. They can be used to filter data. They can also be used to group and count and sum and average and... actually, queries can do load of things! Delete records, insert records, create tables, compare records...
database sigma querycriteriaimport evidence table integer screenshot record text ascending field double descending data type Yes/No