0% found this document useful (0 votes)
4 views3 pages

Create a new PDF for SQL short notes

The document outlines key concepts and commands related to SQL (Structured Query Language) for managing relational databases. It covers basic commands such as SELECT, INSERT, UPDATE, and DELETE, as well as data types, table creation, and data manipulation techniques. Additionally, it discusses filtering, sorting, aggregate functions, joins, constraints, and the advantages of using SQL.

Uploaded by

vijaaykumar20
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)
4 views3 pages

Create a new PDF for SQL short notes

The document outlines key concepts and commands related to SQL (Structured Query Language) for managing relational databases. It covers basic commands such as SELECT, INSERT, UPDATE, and DELETE, as well as data types, table creation, and data manipulation techniques. Additionally, it discusses filtering, sorting, aggregate functions, joins, constraints, and the advantages of using SQL.

Uploaded by

vijaaykumar20
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
You are on page 1/ 3

# Create a new PDF for SQL short notes

pdf_sql = PDF()

pdf_sql.add_page()

# Content for SQL short notes

sql_content = """

1. Introduction to SQL:

SQL (Structured Query Language) is used to manage and manipulate relational databases.

2. Basic SQL Commands:

- SELECT: Retrieve data from a table

- INSERT: Add new records

- UPDATE: Modify existing records

- DELETE: Remove records

3. Data Types in SQL:

- INT, FLOAT, CHAR(n), VARCHAR(n), DATE, TIME, BOOLEAN

4. Creating a Table:

CREATE TABLE Students (

ID INT PRIMARY KEY,

Name VARCHAR(50),

Age INT

);

5. Inserting Data:

INSERT INTO Students (ID, Name, Age) VALUES (1, 'Alice', 20);

6. Retrieving Data:

SELECT * FROM Students;

SELECT Name FROM Students WHERE Age > 18;


7. Updating Data:

UPDATE Students SET Age = 21 WHERE ID = 1;

8. Deleting Data:

DELETE FROM Students WHERE ID = 1;

9. Filtering Data:

- WHERE clause: SELECT * FROM Students WHERE Age > 18;

- AND, OR, NOT operators

10. Sorting Data:

- ORDER BY clause: SELECT * FROM Students ORDER BY Age DESC;

11. Aggregate Functions:

- COUNT(), SUM(), AVG(), MAX(), MIN()

12. Grouping Data:

- GROUP BY clause: SELECT Age, COUNT(*) FROM Students GROUP BY Age;

13. Joins in SQL:

- INNER JOIN: Returns matching records from both tables

- LEFT JOIN, RIGHT JOIN, FULL JOIN

Example:

SELECT Students.Name, Courses.CourseName

FROM Students

INNER JOIN Courses ON Students.ID = Courses.StudentID;

14. Constraints:

- PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, CHECK, DEFAULT


15. Advantages of SQL:

- Easy to learn and use

- Efficient data retrieval and management

- Works with all relational databases

"""

# Add content to PDF

pdf_sql.chapter_title("SQL - Short Notes")

pdf_sql.chapter_body(sql_content)

# Save PDF

sql_pdf_path = "/mnt/data/SQL_Short_Notes.pdf"

pdf_sql.output(sql_pdf_path)

sql_pdf_path

You might also like