0% found this document useful (0 votes)
18 views3 pages

Assignment 1 Part 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Assignment 1 Part 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.


Your MySQL connection id is 14
Server version: 8.0.39 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database company;


Query OK, 1 row affected (0.01 sec)

mysql> use company;


Database changed
mysql> Create table employee(
-> e_no int not null primary key unique auto_increment,
-> e_name varchar(30),
-> post varchar(30),
-> salary int,
-> dateofjoining date,
-> address varchar(30));
Query OK, 0 rows affected (0.03 sec)

mysql> alter table employee auto_increment=1;


Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> insert into employee(e_name,post,salary,dateofjoining,address)


-> values
-> ('Kai','Manager',1100000,20140206,'123 Main St, Springfield');
-> ('Aria','Customer Service',700000,20201101,'456 Elm St, Austin'),
-> ('Elara','COO',8000000,20010128,'789 Oak St, Denver'),
-> ('Clio','Technical Writer',600000,20230526,'101 Pine St, Seattle'),
-> ('Orion','Developer',4000000,20060819,'202 Maple St, Miami');
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0

mysql> select * from employee;


+------+--------+------------------+---------+---------------
+--------------------------+
| e_no | e_name | post | salary | dateofjoining | address
|
+------+--------+------------------+---------+---------------
+--------------------------+
| 1 | Kai | Manager | 1100000 | 2014-02-06 | 123 Main St,
Springfield |
| 2 | Aria | Customer Service | 700000 | 2020-11-01 | 456 Elm St, Austin
|
| 3 | Elara | COO | 8000000 | 2001-01-28 | 789 Oak St, Denver
|
| 4 | Clio | Technical Writer | 600000 | 2023-05-26 | 101 Pine St, Seattle
|
| 5 | Orion | Developer | 4000000 | 2006-08-19 | 202 Maple St, Miami
|
+------+--------+------------------+---------+---------------
+--------------------------+
5 rows in set (0.00 sec)

mysql> describe employee;


+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| e_no | int | NO | PRI | NULL | auto_increment |
| e_name | varchar(30) | YES | | NULL | |
| post | varchar(30) | YES | | NULL | |
| salary | int | YES | | NULL | |
| dateofjoining | date | YES | | NULL | |
| address | varchar(30) | YES | | NULL | |
+---------------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> alter table employee drop column address;


Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> describe employee;


+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| e_no | int | NO | PRI | NULL | auto_increment |
| e_name | varchar(30) | YES | | NULL | |
| post | varchar(30) | YES | | NULL | |
| salary | int | YES | | NULL | |
| dateofjoining | date | YES | | NULL | |
+---------------+-------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql> select * from employee;


+------+--------+------------------+---------+---------------+
| e_no | e_name | post | salary | dateofjoining |
+------+--------+------------------+---------+---------------+
| 1 | Kai | Manager | 1100000 | 2014-02-06 |
| 2 | Aria | Customer Service | 700000 | 2020-11-01 |
| 3 | Elara | COO | 8000000 | 2001-01-28 |
| 4 | Clio | Technical Writer | 600000 | 2023-05-26 |
| 5 | Orion | Developer | 4000000 | 2006-08-19 |
+------+--------+------------------+---------+---------------+
5 rows in set (0.00 sec)
mysql> show tables;
+-------------------+
| Tables_in_company |
+-------------------+
| employee |
+-------------------+
1 row in set (0.01 sec)

mysql> drop table employee;


Query OK, 0 rows affected (0.02 sec)

mysql> show tables;


Empty set (0.00 sec)

mysql> Exit
mysql> show tables;
+--------------------+
| Tables_in_my__shop |
+--------------------+
| customer |
| employee |
| items |
| purchase |
+--------------------+
mysql> drop table employee;
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;


+--------------------+
| Tables_in_my__shop |
+--------------------+
| customer |
| items |
| purchase |
+--------------------+
3 rows in set (0.00 sec)

You might also like