In this session:
• Database Concepts Recap
• SQL Recap
Database concepts
Database: Organized collection of structured information (data)
Need:
Efficiently store and manage large amounts of data
Easy access, retrieval, and modification of data
Data integrity and consistency
Data security
Database Management System (DBMS)
DBMS: Software that manages databases
Functions:
Data creation, storage, retrieval, and modification
Data security and access control
Data backup and recovery
Relational Data Model
Key Concepts:
Relation: A table with columns (attributes) and rows (tuples)
Candidate Key: A minimal set of attributes that uniquely identify a tuple
Primary Key: One candidate key chosen to be the main identifier
Alternate Key: Any candidate key that's not the primary key
Structured Query Language (SQL)
Advantages:
Standard Language: Widely used for interacting with databases
Easy to Learn: Simple, English-like syntax
Powerful: Can perform complex data operations
Flexible: Works with various database systems
SQL Categories
Data Definition Language (DDL):
Creates, modifies, and deletes database structures (e.g., CREATE TABLE,
ALTER TABLE, DROP TABLE)
Data Query Language (DQL):
Retrieves data from the database (e.g., SELECT, FROM, WHERE)
Data Manipulation Language (DML):
Modifies data within tables (e.g., INSERT, UPDATE, DELETE)
Introduction to MySQL
Popular Open-Source DBMS: Widely used for managing relational databases
Easy to Install and Use: User-friendly interface and tools
Creating a Database in MySQL
SQL Command: CREATE DATABASE database_name;
Example: CREATE DATABASE my_school_database;
Data types
Common Data Types:
INT: Integers (whole numbers)
VARCHAR(size): Variable-length strings (text)
DATE: Dates (YYYY-MM-DD format)
BOOLEAN: True/False values
Database Structure
Database Structure
Database Structure
Database Structure
Database Structure
SQL queries in VS code