0% found this document useful (0 votes)
741 views

SQL Module 3 Assignment

The document contains SQL commands to: 1) Create an Orders table with order details and insert sample records. 2) Perform an inner join between Orders and Customer tables. 3) Do left and right outer joins between the same tables. 4) Update the amount to 100 for a specific customer ID in the Orders table.

Uploaded by

Isha Karnalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
741 views

SQL Module 3 Assignment

The document contains SQL commands to: 1) Create an Orders table with order details and insert sample records. 2) Perform an inner join between Orders and Customer tables. 3) Do left and right outer joins between the same tables. 4) Update the amount to 100 for a specific customer ID in the Orders table.

Uploaded by

Isha Karnalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

--1.

Create an ‘Orders’ table which comprises of these columns – ‘order_id’,


‘order_date’, ‘amount’, ‘customer_id’
create table ord(ord_id int primary key, ord_date date, amount int,customer_id int)

insert into ord values(101,'07/31/2022',1500,1);


insert into ord values(102,'01/12/1972',3000,2);
insert into ord values(103,'05/07/2022',2500,3);
insert into ord values(104,'08/15/2022',2000,6);
insert into ord values(105,'11/24/2001',1300,9);

select * from ord

--2.Make an inner join on ‘Customer’ & ‘Ord’ tables on the ‘customer_id’ column

select * from ord


inner join customer c
on ord.customer_id=c.customer_id

--3.Make left and right joins on ‘Customer’ & ‘Order’ tables on the ‘customer_id’
column
select * from ord
left join customer c
on ord.customer_id=c.customer_id

select * from ord


right join customer c
on ord.customer_id=c.customer_id

--4.Update the ‘Orders’ table, set the amount to be 100 where ‘customer_id’ is 3
update orders
set amount = 100
where customer_id = 3

select * from ord

You might also like