Aug 5, 2024
SHOW DATABASES;
कमांड द्वारा डेटाबेस दिखानाCREATE TABLE student (id INT NOT NULL PRIMARY KEY, name VARCHAR(30), address VARCHAR(30), marks INT);
DESC student;
INSERT INTO student (name, id, address, marks) VALUES ('Kamal', 12, 'Delhi', 79);
INSERT INTO student VALUES ('Kamal', 12, 'Delhi', 79);
INSERT INTO student (name, id, address, marks) VALUES ('Ram', 17, 'Delhi', 90), ('Shyam', 18, 'Mumbai', 88);
SELECT * FROM student;
SELECT name, id FROM student;
SELECT * FROM student WHERE id = 12;
UPDATE student SET address = 'Dehradun' WHERE id = 45;
ALTER TABLE student ADD phone_number INT;
ALTER TABLE student DROP COLUMN phone_number;
DELETE FROM student WHERE name = 'Kamal';
SELECT SUM(marks) FROM student;
SELECT AVG(marks) FROM student;
SELECT COUNT(name) FROM student;
SELECT MAX(marks) FROM student;
SELECT MIN(marks) FROM student;
SELECT * FROM student ORDER BY marks ASC;
SELECT * FROM student ORDER BY marks DESC;
SELECT * FROM student INNER JOIN employee ON student.id = employee.id;
SELECT * FROM student LEFT JOIN employee ON student.id = employee.id;
SELECT * FROM student CROSS JOIN employee;
इन नोट्स का उपयोग करते हुए आप SQL की प्रमुख अवधारणाओं को समझ सकते हैं और उन्हें आसानी से याद रख सकते हैं।