Microsoft Windows [Version 10.0.26100.
4351]
(c) Microsoft Corporation. All rights reserved.
C:\Users\likit>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.42 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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> use code;
Database changed
mysql> create table emp(emp_id smallint unsigned,salary decimal(6,2));
Query OK, 0 rows affected (0.23 sec)
mysql> desc emp
-> desc emp;
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 'desc
emp' at line 2
mysql> desc emp;
+--------+-------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------------+------+-----+---------+-------+
| emp_id | smallint unsigned | YES | | NULL | |
| salary | decimal(6,2) | YES | | NULL | |
+--------+-------------------+------+-----+---------+-------+
2 rows in set (0.05 sec)
mysql> insert into emp values(1,6578.89);
Query OK, 1 row affected (0.02 sec)
mysql> select * from emp;
+--------+---------+
| emp_id | salary |
+--------+---------+
| 1 | 6578.89 |
+--------+---------+
1 row in set (0.00 sec)
mysql> insert into emp values(2,6578.9999);
Query OK, 1 row affected, 1 warning (0.01 sec)
mysql> select * from emp;
+--------+---------+
| emp_id | salary |
+--------+---------+
| 1 | 6578.89 |
| 2 | 6579.00 |
+--------+---------+
2 rows in set (0.00 sec)
mysql> insert into emp values(3,56789432111.23);
ERROR 1264 (22003): Out of range value for column 'salary' at row 1
mysql> select * from emp;
+--------+---------+
| emp_id | salary |
+--------+---------+
| 1 | 6578.89 |
| 2 | 6579.00 |
+--------+---------+
2 rows in set (0.00 sec)
mysql> create table emp2(id int unsigned,salary float(3,2));
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> desc emp2;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| id | int unsigned | YES | | NULL | |
| salary | float(3,2) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> \W
Show warnings enabled.
mysql> desc emp2;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| id | int unsigned | YES | | NULL | |
| salary | float(3,2) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> create table emp3(id int unsigned,salary float(3,2));
Query OK, 0 rows affected, 1 warning (0.03 sec)
Warning (Code 1681): Specifying number of digits for floating point data types is
deprecated and will be removed in a future release.
mysql> \w
Show warnings disabled.
mysql> create table product(pid int unsigned,p_name varchar(50));
Query OK, 0 rows affected (0.04 sec)
mysql> desc product;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| pid | int unsigned | YES | | NULL | |
| p_name | varchar(50) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> insert into product values(1,'samsung');
Query OK, 1 row affected (0.08 sec)
mysql> select * from product;
+------+---------+
| pid | p_name |
+------+---------+
| 1 | samsung |
+------+---------+
1 row in set (0.00 sec)
mysql> insert into product values(1,'samsung'),(2,'realme'),(3,'oppo');
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from product;
+------+---------+
| pid | p_name |
+------+---------+
| 1 | samsung |
| 1 | samsung |
| 2 | realme |
| 3 | oppo |
+------+---------+
4 rows in set (0.00 sec)
mysql> create table projects(prj_id int unsigned,prj_name char(20));
Query OK, 0 rows affected (0.04 sec)
mysql> desc projects;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| prj_id | int unsigned | YES | | NULL | |
| prj_name | char(20) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> insert into projects values(1,'abc'),(2,'insta_clone')
->
-> insert into projects values(1,'abc'),(2,'insta_clone');
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 'insert
into projects values(1,'abc'),(2,'insta_clone')' at line 3
mysql> insert into projects values(1,'abc'),(2,'insta_clone');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> desc projects;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| prj_id | int unsigned | YES | | NULL | |
| prj_name | char(20) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> select * from projects;
+--------+-------------+
| prj_id | prj_name |
+--------+-------------+
| 1 | abc |
| 2 | insta_clone |
+--------+-------------+
2 rows in set (0.00 sec)
mysql> create table students(std_id int unsigned,std_name varchar(20),std_fee
decimal(5,2));
Query OK, 0 rows affected (0.06 sec)
mysql> desc students;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| std_id | int unsigned | YES | | NULL | |
| std_name | varchar(20) | YES | | NULL | |
| std_fee | decimal(5,2) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> insert into stduents values(1,'likitha',430000.00),(2,'sai',450000.00),
(3,'peddinti',44000.00));
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 1
mysql> insert into stduents values(1,'likitha',430000.00),(2,'sai',450000.00),
(3,'peddinti',44000.00);
ERROR 1146 (42S02): Table 'code.stduents' doesn't exist
mysql> insert into students values(1,'likitha',430000.00),(2,'sai',450000.00),
(3,'peddinti',44000.00);
ERROR 1264 (22003): Out of range value for column 'std_fee' at row 1
mysql> insert into students values(1,'likitha',43000.00),(2,'sai',45000.00),
(3,'peddinti',44000.00);
ERROR 1264 (22003): Out of range value for column 'std_fee' at row 1
mysql> insert into students values(1,'likitha',430.00),(2,'sai',450.00),
(3,'peddinti',440.00);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from students;
+--------+----------+---------+
| std_id | std_name | std_fee |
+--------+----------+---------+
| 1 | likitha | 430.00 |
| 2 | sai | 450.00 |
| 3 | peddinti | 440.00 |
+--------+----------+---------+
3 rows in set (0.00 sec)
mysql>