show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| fycsdemo1          |
| fyds               |
| joins              |
| logindb            |
| logindb22          |
| mysql              |
| performance_schema |
| peru               |
| root               |
| sakila             |
| seema              |
| serve              |
| stud               |
| student            |
| students           |
| sycs               |
| test               |
| umar1              |
| world              |
| yashzayn           |
+--------------------+
21 rows in set (0.01 sec)

mysql> create database company;
Query OK, 1 row affected (0.00 sec)

mysql> use company;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> create table product(Pid int primary key, Pname varchar(10) not null, price numeric(10),MFR varchar(10),QOH numeric(10));
Query OK, 0 rows affected (0.05 sec)

mysql> desc product;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| Pid   | int(11)       | NO   | PRI | NULL    |       |
| Pname | varchar(10)   | NO   |     | NULL    |       |
| price | decimal(10,0) | YES  |     | NULL    |       |
| MFR   | varchar(10)   | YES  |     | NULL    |       |
| QOH   | decimal(10,0) | YES  |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
5 rows in set (0.01 sec)

mysql> create table orders(Ono int primary key, Odate date,customer varchar(10) not null,Pid int, foreign key(Pid) references product(Pid),qty numeric(10),Oamount numeric(10));
Query OK, 0 rows affected (0.04 sec)

mysql> desc orders;
+----------+---------------+------+-----+---------+-------+
| Field    | Type          | Null | Key | Default | Extra |
+----------+---------------+------+-----+---------+-------+
| Ono      | int(11)       | NO   | PRI | NULL    |       |
| Odate    | date          | YES  |     | NULL    |       |
| customer | varchar(10)   | NO   |     | NULL    |       |
| Pid      | int(11)       | YES  | MUL | NULL    |       |
| qty      | decimal(10,0) | YES  |     | NULL    |       |
| Oamount  | decimal(10,0) | YES  |     | NULL    |       |
+----------+---------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
insert into product values(1,'phone',20000,"LG",50);
Query OK, 1 row affected (0.03 sec)

mysql> insert into product values(2,'laptop',45000."HP",30);
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 '"HP",30)' at line 1
mysql> insert into product values(2,'laptop',45000,"HP",30);
Query OK, 1 row affected (0.03 sec)

mysql> insert into product values(3,'AC',26000,"DAIKIN",15);
Query OK, 1 row affected (0.03 sec)

mysql> insert into product values(3,'tab',50000,"SAMSUNG",23);
ERROR 1062 (23000): Duplicate entry '3' for key 'PRIMARY'
mysql> insert into product values(4,'tab',50000,"SAMSUNG",23);
Query OK, 1 row affected (0.03 sec)

mysql> insert into product value(5,'SmartWatch',40000,"SAMSUNG",33);
Query OK, 1 row affected (0.03 sec)

mysql> select * from product;
+-----+------------+-------+---------+------+
| Pid | Pname      | price | MFR     | QOH  |
+-----+------------+-------+---------+------+
|   1 | phone      | 20000 | LG      |   50 |
|   2 | laptop     | 45000 | HP      |   30 |
|   3 | AC         | 26000 | DAIKIN  |   15 |
|   4 | tab        | 50000 | SAMSUNG |   23 |
|   5 | SmartWatch | 40000 | SAMSUNG |   33 |
+-----+------------+-------+---------+------+
5 rows in set (0.00 sec)

mysql> insert into orders values(1,'2023-03-23','abc',1,1,2000);
Query OK, 1 row affected (0.04 sec)

mysql> insert into orders values(2,'2023-03-15','sakshi',2,4,45000);
Query OK, 1 row affected (0.02 sec)

mysql> insert into orders values(3,'2023-03-13','rutuja',3,5,50000);
Query OK, 1 row affected (0.04 sec)

mysql> insert into orders values (4,'2023-03-17','nutan',4,6,26000);
Query OK, 1 row affected (0.15 sec)


mysql> insert into orders values(5,'2023-03-18','suraj',5,7,40000);
Query OK, 1 row affected (0.02 sec)

mysql> select * from orders;
+-----+------------+----------+------+------+---------+
| Ono | Odate      | customer | Pid  | qty  | Oamount |
+-----+------------+----------+------+------+---------+
|   1 | 2023-03-23 | abc      |    1 |    1 |    2000 |
|   2 | 2023-03-15 | sakshi   |    2 |    4 |   45000 |
|   3 | 2023-03-13 | rutuja   |    3 |    5 |   50000 |
|   4 | 2023-03-17 | nutan    |    4 |    6 |   26000 |
|   5 | 2023-03-18 | suraj    |    5 |    7 |   40000 |
+-----+------------+----------+------+------+---------+
5 rows in set (0.00 sec)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: