What is MySQL?
FundamentalMySQL is a Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). It's:
- Open Source - Free to use and modify
- Relational - Data stored in tables with relationships
- Client-Server - Uses client-server architecture
- ACID Compliant - Ensures data integrity
Key Components
1. Database: Container for tables (SCHOOL)
2. Table: Collection of rows and columns (STUDENT)
3. Column/Field: Single data item (Name, Marks)
4. Row/Record: Complete set of related data (Amit's details)
Quick Quiz
Which SQL command is used to create a new database?
Table Creation Syntax
ImportantBasic syntax for creating tables:
CREATE TABLE table_name (
column1 datatype constraints,
column2 datatype constraints,
column3 datatype constraints,
...
PRIMARY KEY (one_or_more_columns)
);
Common Constraints
NOT NULL - Column cannot have NULL values
UNIQUE - All values must be different
PRIMARY KEY - Unique identifier for each row
FOREIGN KEY - Links to another table's PRIMARY KEY
DEFAULT - Sets default value for column
AUTO_INCREMENT - Automatically increases value