Computer Science, asked by avhaha, 18 days ago

Create the following table and add the records

Attachments:

Answers

Answered by Equestriadash
4

Creating the table:

\tt Create\ table\ Items(ItemNo\ int(4)\ Primary\ key,\ Item\ varch ar(30),\\ DCo de\ int(3),\ Qty\ int(3),\ UnitPrice\ int(2),\ Date\ date);

Inserting the records:

\tt Insert\ into\ Items\ values(5005,\ "Ball\ Pen\ 0.5",\ 102,\ 100,\ 16,\ "2018-03-10");

\tt Insert\ into\ Items\ values(5003,\ "Ball\ Pen\ 0.25",\ 102,\ 150,\ 20,\ "2017-05-17"):

\tt Insert\ into\ Items\ values(5002,\ "Gel\ Pen\ Premium",\ 101,\ 125,\ 14,\ "2018-04-20");

\tt Insert\ into\ Items\ values(5006,\ "Gel\ Pen\ Classic",\ 101,\ 200,\ 22,\ "2018-10-08");

\tt Insert\ into\ Items\ values(5001,\ "Eraser\ Small",\ 102,\ 210,\ 5,\ "2018-03-11");

\tt Insert\ into\ Items\ values(5004,\ "Eraser\ Big",\ 102,\ 60,\ 10,\ "2017-11-18");

\tt Insert\ into\ Items\ values(5009,\ "Sharpener\ Classic",\ Null,\ 160,\ 8,\ "2017-06-12");

Displaying the table:

\tt Select\ *\ from\ Items;

Explanation:

To create a table in MySQL, we use the \tt Create\ table command, followed by the table name, along with its attributes and their respective datatype and the character count for each datatype if needed. To add the records, we use the \tt Insert\ into\ <table\_n ame>\ values command and then specify the values in order of the attributes specified in the command to create the table. To view the table, we use the \tt Select\ *\ from\ <table\_n ame> command.

Answered by ADITYABHAIYT
1

To create a table in MySQL, we use the Create table command, followed by the table name, along with its attributes and their respective datatype and the character count for each datatype if needed. To add the records, we use the Insert into <table_name > values command and then specify the values in order of the attributes specified in the command to create the table. To view the table, we use the Select from <table_name command.

Similar questions