-- INSERTING DATA INTO THE TABLE
/*
CONSTRAINT
1. NOT NULL
This restricts the states that a column cannot contain a null value.
2. UNIQUE
When used with a column, this constraint specifies that each value in the column must be distinct.
3. PRIMARY KEY
A primary key is a field that enables each row in a database to be uniquely identified.
4. FOREIGN KEY
It is a field that can be used to specifically identify each row in a different table.
5. CHECK
This constraint aids in ensuring that a column's values satisfy specific requirement.
6. DEFAULT
When no value is entered by the user, this constraint specifies a default value
*/
-- IF NOT EXISTS
-- if the data is not given in the specified table
-- UNIQUE
/*
create table IF NOT EXISTS Student(
ID int(10) primary key auto_increment,
Name text(30) not null,
Age int(4) unique,
Email varchar(40),
Marks decimal(6,3),
DOB Date
);
-- Inserting data in the table
Insert into Student values(2,"Sam",12,"sam@gmail.com",89,"2019-08-21");
Insert into Student(ID,NAME,Age, DOB) values(3,"Mike",34,"2020-03-18");
-- displaying the values of table
select * from Student;
select Marks from Student;
select Name, DOB from Student;
*/
-- IN-CLASS Q1
create table IF NOT EXISTS Data(
ID int(3),
Name text(15),
Designator text(20),
Contact int(7),
Email text(50)
);
Insert into Data values(101,"Suman","Coordinator", 325689, "suman.@gmail.com");
Insert into Data values(103,"Ravi","HOB", 325634, "ravi.@gmail.com");
Insert into Data values(104,"Alok","IT Coordinator", 325639, "alok.@yahoo.com");
select * from Data;
-- IN-CLASS Q2
create table IF NOT EXISTS College(
ID int(1),
Name text(20),
Stipend text(8),
Subject text(17),
Percentage int(2),
Position text(2)
);
Insert into College values(1,"Anuj",4000,"English",65,"P1");
Insert into College values(2,"Ashu",4500,"History",60,"P2");
Insert into College values(3,"Ruby",3500,"English",55,"P2");
Insert into College values(4,"Raman",3800,"Math",58,"P3");
select * from College;
To embed this project on your website, copy the following code and paste it into your website's HTML: