AllFreePapers.com - All Free Papers and Essays for All Students
Search

7.1 Sql Special Operators

Autor:   •  February 23, 2016  •  Research Paper  •  657 Words (3 Pages)  •  1,517 Views

Page 1 of 3

SQL Textbook Questions – Selecting Columns

Using FireFox we will be running our queries in http://www.mcgoo.com.au/mcgoo_query/ .

When running queries on the ‘Repairs’ database, you need to click the database first to select it.

Chapter 7: Read the information on pages 1-5 – Introduction; The Repairs database revisited; SQL syntax; Selecting columns from a table.

# Note: The text book and the online database aren’t always identical, for example, the field name id# in the text book is called id_numb online. If you think your query is correct, but you are getting an error, check that you are using the correct field name by clicking on the table in McGoo Query. This will run a query that shows the entire table with its contents. You might also have to check that the data is the same. If the data is different to the textbook, modify your query so it works with the online data.

Activity 7.1 (1)

This activity asks you to enter and run each of the queries above to see if you get the same results. I have done these for you in the format that you will continue working with. Run these queries in McGoo Query making sure you get the same results.[pic 1]

 [pic 2]

Technicians

idnumb

name

grade

SQL diagram:        

SQL Query:        SELECT name, grade

                FROM repairs_technicians

SQL results table:

name

grade

Carrol

master

Johnson

trade

Hennesy

apprentice

Carey

trade

                

SQL diagram:        [pic 3][pic 4]

Devices

type

rate

priority

SQL Query:        SELECT *

                FROM repairs_devices

SQL results table:[pic 5]

[pic 6][pic 7]

Devices

type

rate

priority

SQL diagram:        

SQL Query:        SELECT distinct rate

                FROM repairs_devices

SQL results table:

[pic 8]

[pic 9]

SQL diagram:[pic 10]

repairs

job_numb

id_numb

type

owner

date

time

ready

cost

=1470

SQL Query:        SELECT job_numb, type

FROM repairs_repair         

WHERE id_numb = 1470 

SQL results table:

[pic 11]

[pic 12]

SQL diagram:[pic 13]

repairs

job_numb

id_numb

type

owner

date

time

ready

cost

=”drive”

SQL Query:        SELECT owner, type, date

FROM repairs_repair         

WHERE type = “drive” 

SQL results table:

[pic 14]

SQL diagram:[pic 15][pic 16]

repairs

job_numb

id_numb

type

owner

date

time

ready

cost

<= “2010-06-04”

SQL Query:        SELECT job_numb, owner

FROM repairs_repair         

WHERE date <= “2010-06-04”

SQL results table:

[pic 17]

Complete the rest of Activity 7.1 questions

Activity 7.1 (2) – find the results for these from the tables in Appendix 1 first and then run in McGoo Query to check your results. (a) is done for you.

...

Download as:   txt (4.4 Kb)   pdf (302.7 Kb)   docx (801.7 Kb)  
Continue for 2 more pages »