0% found this document useful (0 votes)
7 views3 pages

IT Project

The document describes creating a Frozen Food Supply table with fields for Fcode, Brand, FName, Price, and Quantity. It inserts records for French fries, Chicken Breast, and Vanilla Ice-cream. It then provides examples of SQL commands to: 1) Describe the table structure 2) Select all records from the table 3) Add a Suppliers column to the table 4) Delete records where Price is less than 1000 5) Update the Quantity of Vanilla Ice-cream to 1000

Uploaded by

glorubaby2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

IT Project

The document describes creating a Frozen Food Supply table with fields for Fcode, Brand, FName, Price, and Quantity. It inserts records for French fries, Chicken Breast, and Vanilla Ice-cream. It then provides examples of SQL commands to: 1) Describe the table structure 2) Select all records from the table 3) Add a Suppliers column to the table 4) Delete records where Price is less than 1000 5) Update the Quantity of Vanilla Ice-cream to 1000

Uploaded by

glorubaby2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Create the following table Frozen Food Supply with the following fields

Name Datatype Size Contraints


Fcode Integer 5 Primary Key
Brand Character 25 Not null
FName Character 25 Not null
Price integer 5
Quantity integer 5 Not null

Create database Food;

Use Food;

Create table Frozen Food Supply(Fcode int(5) primary key, Brand


varchar(25) not null, Fname varchar(25) not null, Price int(5), Quantity
int(5) not null);

Insert the following details

FCode Brand FName Price Quantity


1101 Sadia French fries 500 120
1102 Freshly Chicken Breast 1000 256
1103 BaskinRobins Vanilla Ice-cream 1250 575

Insert into Frozen Food Supply values(1101, ‘Sadia’, ‘French Fries’, 500,
120);
Insert into Frozen Food Supply values(1102, ‘Freshly’, ‘Chicken Breast’,
1000, 256);
Insert into Frozen Food Supply values(1103, ‘BaskinRobins’, ‘Vanilla’,
1250, 575);

1) To display the structure of the table Frozen Food Supply


- Desc Frozen Food Supply;
DESCRIBE Table command allows the user to view the structure of an already
created table.
Syntax:
Describe <tablename>;
Eg:
Describe student;
Or
Desc student;

2) To display all records from Frozen Food Supply table.


- Select * from Frozen Food Supply;
SELECT command is used to retrieve a subset of rows or columns from one
or more tables. In other words it is used to make queries on the database.
Syntax:
SELECT <column name> [,<column name>,…..] FROM <table
name> WHERE <condition>;
Eg:
SELECT sno, sname FROM student;

3) To add a column Suppliers to the table Frozen Food Supply


- Alter table Frozen Food Supply add Suppliers varchar(20);
ALTER TABLE command alters the structure of the table. It allows the user To
ADD/DELETE/MODIFY columns or constraints of the table
Syntax:
Alter table <table_name> add/drop <column_name> [datatype];
Alter table <table> modify <column> <new_definition>;
4) To delete Frozen Food Supply record with Price<1000
- Delete from Frozen Food Supply where Price<1000;
DELETE command is used to delete one or more records from the given table.
The WHERE clause in a delete query deletes selected records based on
The condition, if omitted all the records would be deleted.

Syntax:
Delete from <tablename> where <condition>;

5) To update Quantity of Vanilla Ice-cream to 1000 in Frozen Food Supply


table
- Update Frozen Food Supply set quantity=1000 where Fname='vanilla Ice-
cream';
UPDATE command is used to modify the values of one or more records in the
table.
Syntax:
Update <tablename> set column1 = value1[, column2 = value2,..]
where <condition>;
The WHERE clause in an update command updates the selected records
Based on the condition, if omitted all records will be updated

You might also like