+------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ | emp_id | int | NO | PRI | NULL | | | emp_name | varchar(20) | YES | | NULL | | | emp_salary | decimal(10,5) | YES | | NULL | | | address | varchar(20) | YES | | NULL | | +------------+---------------+------+-----+---------+-------+ 4 rows in set (0.03 sec)
mysql> create table fee(fee_id in primary key,fee_date date, fee_status
varchar(20)); 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 'in primary key,fee_date date, fee_status varchar(20))' at line 1 mysql> ^C mysql> create table fee(fee_id int primary key,fee_date date, fee_status varchar(20)); Query OK, 0 rows affected (0.02 sec)
mysql> describe fee;
+------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+-------+ | fee_id | int | NO | PRI | NULL | | | fee_date | date | YES | | NULL | | | fee_status | varchar(20) | YES | | NULL | | +------------+-------------+------+-----+---------+-------+ 3 rows in set (0.00 sec)
mysql> create table furniture(fur_id int primary key,fur_type varchar(20));
Query OK, 0 rows affected (0.02 sec)
mysql> describe furniture;
+----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | fur_id | int | NO | PRI | NULL | | | fur_type | varchar(20) | YES | | NULL | | +----------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec)
mysql> create table hostel(hos_id int primary key,hos_name varchar(20),hos_address
+--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | hos_id | int | NO | PRI | NULL | | | hos_name | varchar(20) | YES | | NULL | | | hos_address | varchar(20) | YES | | NULL | | | hos_rooms | int | YES | | NULL | | | hos_students | int | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 5 rows in set (0.00 sec)
mysql> create table room(room_id int primary key, capacity int);
Query OK, 0 rows affected (0.02 sec)
mysql> describe room;
+----------+------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------+------+-----+---------+-------+ | room_id | int | NO | PRI | NULL | | | capacity | int | YES | | NULL | | +----------+------+------+-----+---------+-------+ 2 rows in set (0.00 sec)
mysql> create table student(stu_id int primary key,stu_name varchar(20),stu_address
mysql> insert into HOSTEL values(1,"ANUJA-1","LONI_KALBOR",20,80,,1,1);
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 ',1,1)' at line 1 mysql> insert into HOSTEL values(1,"ANUJA-1","LONI_KALBOR",20,80,1,1); ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`world`.`hostel`, CONSTRAINT `hostel_ibfk_2` FOREIGN KEY (`rm_id`) REFERENCES `room` (`room_id`)) mysql> insert into employee4 values(4,"OMKAR",10003.00,"PUNE"); ERROR 1062 (23000): Duplicate entry '4' for key 'employee4.PRIMARY' mysql> insert into FEE values(1,'2024-10-22',"PAID"); ERROR 1136 (21S01): Column count doesn't match value count at row 1 mysql> insert into STUDENT values(1,"SUYASH","NAGPUR",21); ERROR 1366 (HY000): Incorrect decimal value: 'NAGPUR' for column 'percentage' at row 1 mysql> insert into STUDENT4 values(1,"SUYASH","NAGPUR",21); Query OK, 1 row affected (0.01 sec)
mysql> insert into STUDENT4 values(2,"SACHIN","LATUR",19);
Query OK, 1 row affected (0.01 sec)
mysql> insert into STUDENT4 values(3,"SHANTANU","PUNE",19);
Query OK, 1 row affected (0.01 sec)
mysql> insert into STUDENT4 values(4,"SUNNY","PUNE",19);
Query OK, 1 row affected (0.01 sec)
mysql> insert into STUDENT4 values(5,"OM","MUMBAI",20);
Query OK, 1 row affected (0.01 sec)
mysql> SELECT * FROM STUDENT2;
+---------+------------+--------+------------+ | roll_no | name | city | percentage | +---------+------------+--------+------------+ | 1 | Om Patil | Mumbai | 90.00000 | | 3 | Harpalsing | Dhule | 92.00000 | | 5 | Sachin | Latur | 90.00000 | | 7 | Jishnu | Surat | 50.00000 | +---------+------------+--------+------------+ 4 rows in set (0.01 sec)