SQL Detailed notes
SQL Detailed notes
1. Introduction to SQL
SQL (Structured Query Language) is a standard language used to interact with relational
databases. It enables users to create, retrieve, update, and delete data efficiently. SQL is widely
used in database management systems like MySQL, PostgreSQL, Oracle, and SQL Server.
Features of SQL:
● Declarative Language
● High Performance
● Portability
● Security
● Scalability
3. SQL Commands
SQL commands are categorized into five types:
4. Constraints in SQL
Constraints are used to enforce rules on data columns.
SQL Subqueries
Views
● Reduces redundancy
● Improves performance
Triggers
Triggers are automatic responses to specific database events.
Keys
9. SQL Functions
Aggregate Functions
String Functions
Date Functions
● NOW() - Returns the current date/time
● DATEADD() - Adds a time interval
● DATEDIFF() - Calculates difference between dates