-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoin.sql
More file actions
19 lines (19 loc) · 682 Bytes
/
join.sql
File metadata and controls
19 lines (19 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
create database joining;
use joining;
create table Liquors(
LiquorID int primary key,
name varchar(20) not null,
brand varchar(20) not null,
alcoholPercentage decimal(10,2) not null
);
create table sales(
saleID int primary key,
customername varchar(20) not null,
LiquorID int, foreign key (LiquorID) references Liquors(LiquorID),
saledate date
);
insert Liquors values (1, 'ashma Gurung', 'Guchaya', 5.2);
insert Liquors values (2, 'Tripti GC', 'Iphone', 6.2);
insert sales values (3, 'Trishna Bhattarai', 1, '2015-05-16');
insert sales values (4, 'Susma Gurung', 2, '2014-01-26');
select name, brand, customername from Liquors inner join sales on Liquors.LiquorID= sales.LiquorID;