Professional Documents
Culture Documents
Table created.
Table created.
Table created.
Table created.
Table created.
Table altered.
Table altered.
Table altered.
SQL> desc orderline_19;
Name Null? Type
----------------------------------------- -------- ----------------------------
ORDER_ID NOT NULL NUMBER
PRODUCT_ID NUMBER
ORDERED_QUANTITY NUMBER
PRICE NUMBER
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
SQL> alter table customer_19 modify customer_address varchar(14) not null;
Table altered.
Table altered.
______________________________________________________________________
EXP-2
1 row updated.
SQL> select* from customer_19;
1 row created.
1 row deleted.
8 rows selected.
PRODUCT_DESCRIPTION
--------------------
Duplex Table Lamp
Book Shelf
Table Lamp
Office Desk
Office Chair
Keyboard
DuplexBookShelf
11 rows selected.
8. Show the customers details who have ordered the table lamp.
SQL> select customer_name,customer_address from( ((customer_19 inner join order_
19 on customer_19.customer_id=order_19.customer_id )inner join orderquantity_19
on order_19.order_id=orderquantity_19.order_id ) inner join product_19 on produc
t_19.product_id=orderquantity_19.product_id)where product_19.product_description
='Table Lamp' ;
CUSTOMER_NAME CUSTOMER_ADDRESS
------------------------------ -------------------------
John Doe 392 Sunset Blvd
Henry Smith 6900 Main St
9. How many customers have a name that ends with the letter 'a'?
no rows selected
10. List the customers who have the letter ‘y’ in their name.
SQL> select customer_name from customer_19 where customer_name like '%y%';
CUSTOMER_NAME
------------------------------
Henry Smith
11. Show the customers whose name starts with the letter ‘j’.
CUSTOMER_NAME
------------------------------
John Doe
Joe Joe
12. List the names of the customers whose ordered quantity is between 10 to
15.
SQL> select customer_name from( (customer_19 inner join order_19 on
customer_19.customer_id=order_19.customer_id ) inner join orderquantity_19 on
order_19.order_id=orderquantity_19.order_id)where
orderquantity_19.ordered_quantity>10 and orderquantity_19.ordered_quantity<15;
CUSTOMER_NAME
------------------------------
Richard Newman
Henry Smith
Henry Smith
Henry Smith
1 row updated.
CUSTOMER_NAME
------------------------------
Henry Smith
Joe Joe
John Doe
Richard Newman
15. Find the number of orders placed on 10-OCT-2014.
SQL> select count(*) from order_19 where order_date='10-OCT-14';
COUNT(*)
----------
4
16. Show the order details, customer details for the product_id ‘1000’.
SQL> select customer_19.customer_name,customer_19.customer_address,
order_19.order_id, order_19.order_date,orderquantity_19.ordered_quantity
from customer_19
inner join order_19 on customer_19.customer_id=order_19.customer_id
inner join orderquantity_19 on order_19.order_id=orderquantity_19.order_id
where orderquantity_19.product_id=1000
17. View the customer table of your Friend who is next to you using
appropriate DCL Commands
SQL> select* from urk17bi010.customer_010;