Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 4

SQL

create the Student_Records table in SQL:

CREATE TABLE Student_Records


(
Student_Id Int PRIMARY KEY,
First_Name VARCHAR (20),
Address VARCHAR (20),
Age Int NOT NULL,
Percentage Int NOT NULL,
Grade VARCHAR (10)
);
The following query inserts the record of intelligent students into the Student_Records table:

INSERT INTO Student VALUES (201, Akash, Delhi, 18, 89, A2),
(202, Bhavesh, Kanpur, 19, 93, A1),
(203, Yash, Delhi, 20, 89, A2),
(204, Bhavna, Delhi, 19, 78, B1),
(05, Yatin, Lucknow, 20, 75, B1),
(206, Ishika, Ghaziabad, 19, 51, C1),
(207, Vivek, Goa, 20, 62, B2);

16-10-2023 2
The following SQL query displays all the values of each column from the above Student_records tab

SELECT * FROM Student_Records;

The output of the above query is:

Student_ID First_Name Address Age Percentage Grade


201 Akash Delhi 18 89 A2
202 Bhavesh Kanpur 19 93 A1
203 Yash Delhi 20 89 A2
204 Bhavna Delhi 19 78 B1
205 Yatin Lucknow20 75 B1
206 Ishika Ghaziabad 19 91 C1
207 Vivek Goa 20 80 B2

16-10-2023 3
SELECT Statement with WHERE clause

The WHERE clause is used with SELECT statement to return only those rows from the table, whi

In SQL, the WHERE clause is not only used with SELECT, but it is also used with other SQL state

Syntax of SELECT Statement with WHERE clause

SELECT * FROM Name_of_Table WHERE [condition];

EXAMPLE:

SELECT * FROM Employee_Details WHERE Emp_Panelty = 500;

16-10-2023 4

You might also like