0% found this document useful (0 votes)
7 views

SQL Commands (BK)

The document contains a series of SQL commands for managing a database named 'krish' and a table called 'student'. It includes commands for creating, using, and dropping the database, as well as defining the student table structure, inserting records, and querying the data based on various conditions. The document demonstrates basic SQL operations such as SELECT, INSERT, UPDATE, and filtering results.

Uploaded by

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

SQL Commands (BK)

The document contains a series of SQL commands for managing a database named 'krish' and a table called 'student'. It includes commands for creating, using, and dropping the database, as well as defining the student table structure, inserting records, and querying the data based on various conditions. The document demonstrates basic SQL operations such as SELECT, INSERT, UPDATE, and filtering results.

Uploaded by

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

SHOW DATABASES;

CREATE DATABASE krish;

USE krish;

DROP DATABASE krish;

EXIT;

CREATE TABLE student


(
rollno INT PRIMARY KEY,
name VARCHAR(30),
sub VARCHAR(30),
marks INT,
dob DATE,
city VARCHAR(30)
);

DESCRIBE student;
DESC student;

INSERT INTO student


VALUES(2262,"Sunil Kumar","English",85,"1990-10-23","Jaipur");

SELECT * FROM student;

SELECT name, marks FROM student;

INSERT INTO student


VALUES
(2264,"Prashant Arya","Science",87,"1989-08-15","Bikaner"),
(2265,"Laxmikant","Mathematics",82,"1990-05-06","Nawada");

INSERT INTO student(rollno,name,sub,marks,city)


VALUES(2266,"Antesh Kumar","Science",78,"Ranchi");

SELECT * FROM student


WHERE marks < 80;

UPDATE student
SET dob = "1947-08-15"
WHERE rollno = 2266;

SELECT * FROM student


WHERE sub = "Science";

SELECT * FROM student


WHERE sub != "Science";

SELECT * FROM student


WHERE sub <> "Science";

SELECT * FROM student


WHERE marks >= 81 AND marks <= 85;

SELECT * FROM student


WHERE marks BETWEEN 81 AND 85;
SELECT DISTINCT sub FROM student;

You might also like