C:\Users\HP>cd C:\Program Files\MySQL\MySQL Server 8.
0\bin
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
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> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| dbms_practicals |
| information_schema |
| mysql |
| performance_schema |
| practical1 |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql> USE practical1;
Database changed
mysql> SHOW TABLES;
+----------------------+
| Tables_in_practical1 |
+----------------------+
| emp_finance |
| employee |
+----------------------+
2 rows in set (0.07 sec)
mysql> INSERT INTO employeee(emp_id int,emp_
-> name char(20),emp_join_date date,primary key
-> (emp_id)) VALUES(1,'Sahil','24/4/2024');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'int,emp_
name char(20),emp_join_date date,primary key
(emp_id)) VALUES(1,'Sahil'' at line 1
mysql> INSERT INTO employee VALUES(1,'Sahil','24/4/2024');
ERROR 1292 (22007): Incorrect date value: '24/4/2024' for column 'emp_join_date' at
row 1
mysql> INSERT INTO employee VALUES(1,'Sahil','2024/4/24');
Query OK, 1 row affected, 1 warning (0.06 sec)
mysql> INSERT INTO employee VALUES(2,'Akash','2024/5/4'),(2,'Akash','2024/5/4');
ERROR 1062 (23000): Duplicate entry '2' for key 'employee.PRIMARY'
mysql> INSERT INTO employee VALUES(2,'Akash','2024/5/4'),(4,'Aditya','2024/
5/20');
Query OK, 2 rows affected, 2 warnings (0.06 sec)
Records: 2 Duplicates: 0 Warnings: 2
mysql> SELECT* FROM employee;
+--------+----------+---------------+
| emp_id | emp_name | emp_join_date |
+--------+----------+---------------+
| 1 | Sahil | 2024-04-24 |
| 2 | Akash | 2024-05-04 |
| 4 | Aditya | 2024-05-20 |
+--------+----------+---------------+
3 rows in set (0.00 sec)
mysql> UPDATE employee SET emp_id ='3' WHERE emp_name='Aditya';
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT* FROM employee;
+--------+----------+---------------+
| emp_id | emp_name | emp_join_date |
+--------+----------+---------------+
| 1 | Sahil | 2024-04-24 |
| 2 | Akash | 2024-05-04 |
| 3 | Aditya | 2024-05-20 |
+--------+----------+---------------+
3 rows in set (0.00 sec)
mysql> INSERT INTO employee VALUES(4,'Aarya','2024/4/30');
Query OK, 1 row affected, 1 warning (0.06 sec)
mysql> SELECT* FROM employee;
+--------+----------+---------------+
| emp_id | emp_name | emp_join_date |
+--------+----------+---------------+
| 1 | Sahil | 2024-04-24 |
| 2 | Akash | 2024-05-04 |
| 3 | Aditya | 2024-05-20 |
| 4 | Aarya | 2024-04-30 |
+--------+----------+---------------+
4 rows in set (0.00 sec)
mysql> INSERT INTO emp_finance VALUES(1,1,2000000,'2034/5/24'),
(2,2,1500000,'2034/5/20'),(3,3,1200000,2034/6/14),(4,4,1700000,2034/7/4);
ERROR 1292 (22007): Incorrect date value: '24.214285714285714285' for column
'emp_contract' at row 3
mysql> INSERT INTO emp_finance VALUES(1,1,2000000,'2034/5/24'),
(2,2,1500000,'2034/5/20'),(3,3,1200000,2034/6/14),(4,4,1700000,'2034/7/4');
ERROR 1292 (22007): Incorrect date value: '24.214285714285714285' for column
'emp_contract' at row 3
mysql> INSERT INTO emp_finance VALUES(1,1,2000000,'2034/5/24'),
(2,2,1500000,'2034/5/20'),(3,3,1200000,'2034/6/14'),(4,4,1700000,'2034/7/4');
Query OK, 4 rows affected, 4 warnings (0.06 sec)
Records: 4 Duplicates: 0 Warnings: 4
mysql> SELECT* FROM emp_finance;
+--------+--------+------------+--------------+
| pay_id | emp_id | emp_salary | emp_contract |
+--------+--------+------------+--------------+
| 1 | 1 | 2000000 | 2034-05-24 |
| 2 | 2 | 1500000 | 2034-05-20 |
| 3 | 3 | 1200000 | 2034-06-14 |
| 4 | 4 | 1700000 | 2034-07-04 |
+--------+--------+------------+--------------+
4 rows in set (0.00 sec)
mysql> CREATE VIEW empdetails
-> as
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 2
mysql> CREATE VIEW Empdetails
-> AS
-> SELECT e.emp_id,e.emp_name,f.emp_salary
-> FROM employee AS e INNER JOIN emp_finance AS f
-> WHERE e.emp_id -f.emp_id;
Query OK, 0 rows affected (0.11 sec)
mysql> SELECT * FROM empdetails;
+--------+----------+------------+
| emp_id | emp_name | emp_salary |
+--------+----------+------------+
| 4 | Aarya | 2000000 |
| 3 | Aditya | 2000000 |
| 2 | Akash | 2000000 |
| 4 | Aarya | 1500000 |
| 3 | Aditya | 1500000 |
| 1 | Sahil | 1500000 |
| 4 | Aarya | 1200000 |
| 2 | Akash | 1200000 |
| 1 | Sahil | 1200000 |
| 3 | Aditya | 1700000 |
| 2 | Akash | 1700000 |
| 1 | Sahil | 1700000 |
+--------+----------+------------+
12 rows in set (0.00 sec)
mysql> CREATE INDEX numbers ON TABLE employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'TABLE
employee' at line 1
mysql> CREATE INDEX numbers ON TABLE employee(emp_name);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'TABLE
employee(emp_name)' at line 1
mysql> CREATE INDEX numbers ON employee(emp_name);
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM employee;
+--------+----------+---------------+
| emp_id | emp_name | emp_join_date |
+--------+----------+---------------+
| 1 | Sahil | 2024-04-24 |
| 2 | Akash | 2024-05-04 |
| 3 | Aditya | 2024-05-20 |
| 4 | Aarya | 2024-04-30 |
+--------+----------+---------------+
4 rows in set (0.00 sec)
mysql> CREATE INDEX numbers ON empdetails(emp_name);
ERROR 1347 (HY000): 'practical1.empdetails' is not BASE TABLE
mysql>