DATABASES - QUERY DATA
In today's lesson, we started looking up data by using Query Design. Query Data is useful because it sorts information, looks for patterns and lets you find information you are looking for. Attached below are images of what I did and how I did them.
In the first screenshot, I went on query design and put in <2000 (less than 2000) in the engine capacity field.
I then pressed run and all the data with <2000 engine capacity cars showed up like this:
In the third screenshot, again I went on query design and put in <=2000 (less than or equal to 2000) in the engine capacity field.
I then pressed run and all the data with <=2000 engine capacity cars showed up like this:
In query design I put in >2000 (greater than 2000) in the engine capacity field.
I ran the data and all the cars with >2000 engine capacity cars showed up like this:
In query design I put in >=2000 (greater than or equal to 2000) in the engine capacity field.
I ran the data and all the cars with engine capacity >=2000 showed up like this:
In query design I put in 'BETWEEN 1000 AND 3000' in the engine capacity field.
I ran the data and all the cars with engine capacity between 1000 and 3000 showed up like this:
In query design I put in 'audi OR BMW' in the manufacturer field.
I ran the data and all the audi or BMW cars showed up like this:
In query design I put in 'audi' in the manufacturer field and >3000 (greater than 3000) in the engine capacity field..
I ran the data and all the audi cars that have engine capacity greater than 3000 showed up like this:
In query design I put in 'not audi' in the manufacturer field.
I ran the data and all the cars except audi showed up like this:
In query design I put in this sign '*' in the manufacturer field as this searches all the cars in the database.
I ran the data and all the cars in the database showed up like this:
In query design I put in 'Is Null' in the manufacturer field as this searches for blank fields in the database.
I ran the data and all the blank fields in the database showed up like this:
'Is Null' is would be used and is useful because if the user has forgotten to fill in some records and they want to fill them in, they can use Is Null to get the blank record and continue to fill in the record.
The difference between Or and And is that Or is if you want to search any one of your chosen record/ data (at least one condition that you entered would show up). And is when you want to search for 2 conditions not only one of them (eg. Audi and <3000 would search all Audi cars that have an engine capacity less than 3000). You have to know the correct time to use OR and AND because they are very different and mean totally different things so you have to be careful and watch out otherwise your data won't come up as you wanted.
When you want to sort the fields, you write in your data and click on sort, use the drop down list and choose ascending or descending and that is how you sort the fields. This is useful because it lets you sort your fields and choose whether you want your data to loom up ascending or descending.
This was an interesting part to the lesson as we learned how to use databases and search for data that we specifically need.