Assignment

Name: Anisha Islam Mou
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

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

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

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

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

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