0% found this document useful (0 votes)
5 views2 pages

MySQL Quick Revision Notes

MySQL is an open-source RDBMS that utilizes SQL for data management. The document outlines various SQL commands including DDL, DML, DQL, and aggregate functions, as well as important clauses, operators, and joins. It also provides exam tips for effective query practice and syntax revision.

Uploaded by

Harjot Singh
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)
5 views2 pages

MySQL Quick Revision Notes

MySQL is an open-source RDBMS that utilizes SQL for data management. The document outlines various SQL commands including DDL, DML, DQL, and aggregate functions, as well as important clauses, operators, and joins. It also provides exam tips for effective query practice and syntax revision.

Uploaded by

Harjot Singh
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

MySQL Quick Revision Notes (IT 802)

1. What is MySQL?

MySQL is an open-source Relational Database Management System (RDBMS) that uses SQL to
manage data in tables.

2. DDL Commands
CREATE DATABASE db_name;
CREATE TABLE student (
id INT,
name VARCHAR(50),
marks INT
);
ALTER TABLE student ADD age INT;
DROP TABLE student;

3. DML Commands
INSERT INTO student VALUES (1, 'Rahul', 90);
UPDATE student SET marks = 95 WHERE id = 1;
DELETE FROM student WHERE id = 1;

4. DQL Commands
SELECT * FROM student;
SELECT name, marks FROM student WHERE marks > 80;

5. Important Clauses
SELECT * FROM student WHERE marks > 50;
SELECT * FROM student ORDER BY marks DESC;
SELECT marks, COUNT(*) FROM student GROUP BY marks;
SELECT marks, COUNT(*) FROM student GROUP BY marks HAVING COUNT(*) > 1;

6. Aggregate Functions
SELECT COUNT(*) FROM student;
SELECT MAX(marks) FROM student;
SELECT MIN(marks) FROM student;
SELECT AVG(marks) FROM student;
SELECT SUM(marks) FROM student;

7. Operators
SELECT * FROM student WHERE marks > 80 AND age < 18;

8. LIKE Operator
SELECT * FROM student WHERE name LIKE 'A%';
SELECT * FROM student WHERE name LIKE '%a';
SELECT * FROM student WHERE name LIKE '_a%';

9. Keys and Constraints

Primary Key: Unique, Not NULL Foreign Key: Links tables Constraints: NOT NULL, UNIQUE,
DEFAULT

10. Joins
SELECT [Link], [Link]
FROM student s
INNER JOIN class c
ON [Link] = [Link];

SELECT *
FROM student
LEFT JOIN class
ON [Link] = [Link];

11. Functions
SELECT UPPER(name);
SELECT LOWER(name);
SELECT LENGTH(name);
SELECT ROUND(45.678, 2);

12. Common Queries


SELECT * FROM student WHERE marks = (SELECT MAX(marks) FROM student);
SELECT COUNT(*) FROM student;
SELECT * FROM student WHERE marks BETWEEN 50 AND 80;

Exam Tips

Use WHERE with UPDATE/DELETE, check syntax, revise JOIN and GROUP BY, and practice
queries.

You might also like