Assignment

Name: Anisha Islam Mou
amou@masonlive.gmu.edu
Course number: AIT 524 (Spring-2021)
Section: DL1
Assignment:
For the database you designed in the previous assignments, complete the following
problems:
1. Write a SQL code to join two tables using the WHERE statement. Explain what the
query is intended to do.
Explanation:
The query shows all the records of the table customers and orders by joining them through the
common field CUST_ID.
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

2. Repeat problem 1 using the JOIN … USING keywords.
Explanation:
This query shows all the records of table orders and orderline by joining them HROUGH
ORDER_ID.
3. Repeat problem 1 using the JOIN … ON keywords.
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

Explanation:
The above query shows all the records in orderline and meals by joining them through the
common field MEAL_ID.
4. Repeat problem 1 but add at least two conditions in the WHERE statement and use an
arithmetic and a special operator. Use logical operators to combine multiple conditions.
Explain what the query is intended to do.
Explanation:
This query shows all the records from customers and orders table where order_date is after
05/04/2003 and the cust_address contains the letter N.
5. Repeat problem 2 but add two more conditions in the WHERE statement and use an
arithmetic and a special operator that are different from the ones you used in the
previous query. Use logical operators to combine multiple conditions. Explain what the
query is intended to do.
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

Explanation:
The query shows all the records from customers and orders table, where cust_zipcode is 20562
and order_id is less than 2 orcust_address contains letter L.
6. -9 Repeat problems 1-4 above to join three tables.
USING WHERE :
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

Explanation:
The above query shows all the records from three tables orders,orderline and meals through the
common field MEAL_ID.
USING JOIN…USING:
Explanation:
The query shows all the records from the orders, orderline and meals table through the common
field MEAL_ID.
USING JOIN…ON:
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

Explanation:
The above query shows all the records from the three tables; customers, orders and orderline
through the common field ORDER_ID.
Using at least two conditions in the WHERE statement and using an arithmetic and a
special operator. Use logical operators to combine multiple conditions. Explain what the
query is intended to do.
Explanation:
The above query shows all the records from three tables: orders, orderline and meals, where meal
price is 25.35 and 31.31 or the order_quantity is greater than 1, and the meal_name contains the
letter “I”.
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/

10.Write a SQL query that joins four tables using any type of join and uses both an
arithmetic and special operator. Explain what the query is intended to do.
Explanation:
The query shows all the records from the four tables: customers, orders,orderline and
meals;where meal_price is greater than 21 and either cust_name contains the letter “I” or
cust_state is “Florida”.
This study source was downloaded by 100000757387545 from CourseHero.com on 03-02-2023 23:31:46 GMT -06:00
https://www.coursehero.com/file/117754445/M6-1-Assignment-Joining-Datadocx/
Powered by TCPDF (www.tcpdf.org)

GET HELP WITH YOUR HOMEWORK PAPERS @ 25% OFF

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

Write My Paper Button

WeCreativez WhatsApp Support
We are here to answer your questions. Ask us anything!
👋 Hi, how can I help?
Scroll to Top