Day 1: Introduction to Databases and SQL
Introduction:
Databases are organized collections of data.
SQL (Structured Query Language) is used to manage and manipulate databases.
Key Concepts:
Database: A collection of related data.
Table: A collection of rows and columns in a database.
Row: A single record in a table.
Column: A single field in a table.
SQL Basics:
SQL is used to perform tasks such as retrieving data, updating data, deleting data, and inserting new data.
Simple SQL Example:
sql
-- Create a new database
CREATE DATABASE StudentsDB;
-- Use the new database
USE StudentsDB;
-- Create a new table
CREATE TABLE Students (
StudentID int,
FirstName varchar(255),
LastName varchar(255),
Age int
);
-- Insert data into the table
INSERT INTO Students (StudentID, FirstName, LastName, Age)
VALUES (1, 'John', 'Doe', 21);
-- Retrieve data from the table
SELECT * FROM Students;
0 Comments