Professional Documents
Culture Documents
source: LinkedIn
Things you need to know
q You must only attend the tutorial that you have enrolled in.
q Please be prepared!
§ Before class: Email your tutor the homework - this will be checked and marked.
§ During class:
§ Week 1: Introduction to SQL
§ We will run through the SQL Demo Script (download from Moodle)
§ Copy paste the script into SQL Developer and follow along
§ Weeks 2 - 3: ER Modelling
§ Apply theory taught in lecture
§ Go through examples and exercises
§ Complete lab exercises on ER modelling
§ Week 4 onwards: SQL
§ We will run through the MCQ’s from the previous weeks HW
§ We will run through the SQL Demo Script (download from Moodle)
§ Copy paste the script into SQL Developer and follow along
Things you need to know - Online
q Punctuality
§ Please be in the Collaborate Ultra classroom 10 - 15 minutes early.
q Attendance
§ Attendance will be marked virtually, if you exit the classroom or do not
participate this will be recorded.
§ Please attend the correct virtual workshop.
q Communication
§ Please have a working headset or microphone for verbal
communication.
§ Do not talk over others, please use the “Raise the Hand” function.
§ Please be in a quiet environment - no background disruptions e.g.
barking dog, music, television noise etc.
Assessment Overview
Clarifying attendance and lab requirements
q Attendance and lab exercises:
§ To get full attendance, you must come to class and fully participate.
§ Business School requires 80% minimum attendance.
§ Homework: From Week 2, you will have to hand in the relevant HW from Moodle
§ See “Lab Exercises (Homework)” on Moodle
§ Be sure to use the HW submission template provided.
§ HW should be emailed to your tutor prior to the start of the lab with the subject in
the format of “INFS1603/COMM1822: Week x HW”
§ This will contribute to your 10% “Lab Exercises” mark.
q If you are sick or unable to attend the lab, e-mail the the HW prior to class anyways as this may
be marked pending special considerations approval
§ Contact the special considerations unit via MyUNSW within 3 days of the tutorial
§ See list of valid circumstances here: https://student.unsw.edu.au/special-consideration.
Admin
Please note that only your UNSW
The best way to contact your
email account should be used for
lecturer or tutor is via email
formal notices and correspondence
or MS Teams.
regarding the course.
9
Things to consider when choosing group
members
11
SQL
12
Understanding SQL Query Structures
q The SELECT statement is used to retrieve and display data from one or more tables.
13
Understanding SQL Query Structures
Example Relations/Tables:
14
15
Understanding SQL Query Structures
q SQL allows us to use the keyword ALL or * to specify that all tuples are to be
selected.
SELECT ALL
FROM PRODUCT;
or
SELECT *
FROM PRODUCT;
* : is a “wild card.”
16
Understanding SQL Query Structures
Question: How could there be duplicates, are relations not duplicate free?
17
Understanding SQL Query Structures
SELECT <columns>
FROM <table>
etc.
18
Understanding SQL Query Structures
q Produce a list of product description, product indate and product price produced by
vendor whose vendor code is “21344”:
etc.
19
Mathematical Operators for SQL
20
Mathematical Operators for SQL
q Create a list of product description, product indate and product price for products
sold by vendor that are not coded “21344”.
q Create a list of product description, product onhand, product minimum, and product
price for products with product code less than “1558-QWI”.
21
ASCII Codes in SQL
22
Logical (Boolean) Operators in SQL
q OR
q AND
q NOT
23
Logical (Boolean) Operators in SQL
q List products where either the product indate is after July 15, 2015 and the product
price is less than 50.00 – or the vendor code is 24288.
24
Special Operators in SQL
25
Special Operators in SQL
SELECT *
FROM PRODUCT
WHERE P_Price BETWEEN 50.00 AND 100.00;
or
SELECT *
FROM PRODUCT
WHERE P_Price >= 50.00 AND P_Price <= 100.00;
26
Special Operators in SQL
q List the details of all vendors whose last name begins with “Smith.”
% : wild card
27
Special Operators in SQL
q List the contents of the product table where the product price is $ 50 or $ 100.
SELECT *
FROM PRODUCT
WHERE P_Price = 50.00 OR P_Price = 100.00;
or
SELECT *
FROM PRODUCT
WHERE P_Price IN (50.00, 100.00);
28
Special Operators in SQL
SELECT *
FROM PRODUCT
WHERE V_Code EXISTS;
or
SELECT *
FROM PRODUCT
WHERE NOT ISNULL (V_Code);
29
Ordering SQL Results
30
Ordering SQL Results
q List the details of product table listed by product price in ascending order:
31
Ordering SQL Results
q List the details of of products with an in-date before 15 September 1999 and a price
less than A$ 50.
q Put the results in ascending order of vendor code and descending order of price.
32
Lab Script!
Oracle Setup:
q Usernames and
passwords have been
sent to your UNSW
email account
Homework
34
SQL Homework (Week 1, Week 4 – 10)
q The homework file may have three sections (sometimes two sections):
q Hands-On Assignments – you have to submit both the SQL script and the SQL
output. You can submit the output as a screen capture or as a query report (export
of the data).
q Advanced Challenge – you have to submit both the SQL script and the SQL output.
You can submit the output as a screen capture or as a query report (export of the
data).
SQL Homework