-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-postgres.sql
More file actions
25 lines (20 loc) · 867 Bytes
/
Copy pathsetup-postgres.sql
File metadata and controls
25 lines (20 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- PostgreSQL Setup for Teachers Database
-- Run this script in PostgreSQL
CREATE DATABASE classroom_db;
\c classroom_db;
CREATE TABLE teachers (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
phone VARCHAR(20) NOT NULL,
specialization VARCHAR(100) NOT NULL,
experience INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_teacher_email ON teachers(email);
-- Sample data
INSERT INTO teachers (name, email, phone, specialization, experience) VALUES
('Dr. John Smith', 'john.smith@school.com', '+1234567890', 'Mathematics', 10),
('Ms. Sarah Johnson', 'sarah.johnson@school.com', '+1234567891', 'English', 8),
('Mr. Mike Williams', 'mike.williams@school.com', '+1234567892', 'Physics', 12);