-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAsg_2.txt
141 lines (118 loc) · 4.78 KB
/
Asg_2.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
AARTI RATHI
My website - https://shinchancode.github.io/3d-react-portfolio/
Problem Statement :
Design and implement a database (for assignment 1) using DDL statements and apply normalization on the.
Multinational Company Manages information of Employees. Each Employee has unique ID. Each Employee works on project in some department
-----------------------------------------------------------------------------------------------------------------
mysql> create database mydb;
Query OK, 1 row affected (0.91 sec)
mysql> use mydb;
Database changed
mysql> show tables;
Empty set (0.61 sec)
mysql> create table Employee(Emp_id int, Ename varchar(20),Address varchar(20));
Query OK, 0 rows affected (2.31 sec)
mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| employee |
+----------------+
1 row in set (0.16 sec)
mysql> desc Employee;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| Emp_id | int | YES | | NULL | |
| Ename | varchar(20) | YES | | NULL | |
| Address | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.13 sec)
mysql> desc Employee;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| Emp_id | int | YES | | NULL | |
| Ename | varchar(20) | YES | | NULL | |
| Address | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> insert into Employee values(1256,'Aarti Rathi','Khadki Pune');
Query OK, 1 row affected (0.17 sec)
mysql> desc Employee;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| Emp_id | int | YES | | NULL | |
| Ename | varchar(20) | YES | | NULL | |
| Address | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.22 sec)
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
+--------+-------------+-------------+
1 row in set (0.11 sec)
mysql> insert into Employee values(1256,'Mini','AIT Pune');
Query OK, 1 row affected (0.12 sec)
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
| 1256 | Mini | AIT Pune |
+--------+-------------+-------------+
2 rows in set (0.00 sec)
mysql> insert into Employee values
-> (8563,'Aditya','Aundh Pune');
Query OK, 1 row affected (0.18 sec)
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
| 1256 | Mini | AIT Pune |
| 8563 | Aditya | Aundh Pune |
+--------+-------------+-------------+
3 rows in set (0.00 sec)
mysql> update Employee
-> set Emp_id=7834
-> where Ename='Mini';
Query OK, 1 row affected (0.23 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
| 7834 | Mini | AIT Pune |
| 8563 | Aditya | Aundh Pune |
+--------+-------------+-------------+
3 rows in set (0.04 sec)
mysql> insert into Employee
-> values(1489,'Sahil','Mumbai');
Query OK, 1 row affected (0.11 sec)
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
| 7834 | Mini | AIT Pune |
| 8563 | Aditya | Aundh Pune |
| 1489 | Sahil | Mumbai |
+--------+-------------+-------------+
4 rows in set (0.00 sec)
mysql> delete from Employee
-> where Ename='Sahil';
Query OK, 1 row affected (0.30 sec)
mysql> select * from Employee;
+--------+-------------+-------------+
| Emp_id | Ename | Address |
+--------+-------------+-------------+
| 1256 | Aarti Rathi | Khadki Pune |
| 7834 | Mini | AIT Pune |
| 8563 | Aditya | Aundh Pune |
+--------+-------------+-------------+
3 rows in set (0.09 sec)