-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.sql
More file actions
44 lines (35 loc) · 912 Bytes
/
temp.sql
File metadata and controls
44 lines (35 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
show DATABASES;
use temp;
CREATE TABLE student(
id INT PRIMARY KEY,
name VARCHAR(25)
);
INSERT INTO student VALUES(1,'Khushi');
SELECT * FROM student;
DROP DATABASE IF EXISTS temp;
CrEATE DATABASE temp;
use temp;
CREATE TABLE Customer(
id INT PRIMARY KEY,
name VARCHAR(25),
Address VARCHAR(100),
Gender VARCHAR(10),
Pincode INT
);
ALTER TABLE Customer
ADD City VARCHAR(15);
INSERT INTO customer
VALUES(1251,'Priyanshi','Ok elevator','F',302021,'Jaipur'),
(1300,'Priyanshi','Sanskar','F',302021,'Jaipur'),
(245,'Palak','Agra road','F',302021,'Jaipur'),
(210,'Himanshu','Jaipur','M',302022,'Mumbai'),
(500,'Abhishek','Delhi','M',110001,'Delhi');
INSERT INTO customer
VALUES(1252,'Kinjal','Kanpur','F',208001,'UP');
use temp;
CREATE TABLE Order_details(
Order_id INT PRIMARY KEY,
delivery_date DATE,
cust_id INT,
FOREIGN KEY (cust_id) REFERENCES Customer(id)
);