diff --git a/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.odt b/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.odt new file mode 100644 index 0000000..b7def87 Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.odt differ diff --git a/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.pdf b/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.pdf new file mode 100644 index 0000000..e7d1d27 Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/Session4_ThanawinPattanaphol.pdf differ diff --git a/fall-2025/sen-209/labs/Session4/commands.md b/fall-2025/sen-209/labs/Session4/commands.md index f7c166e..bc16fe0 100644 --- a/fall-2025/sen-209/labs/Session4/commands.md +++ b/fall-2025/sen-209/labs/Session4/commands.md @@ -5,9 +5,9 @@ CREATE DATABASE library; ## Table creation CREATE TABLE book ( - isbn INT PRIMARY KEY, - title VARCHAR(100) NOT NULL, - author VARCHAR(100) NOT NULL, + isbn BIGINT PRIMARY KEY, + title VARCHAR(50) NOT NULL, + author VARCHAR(50) NOT NULL, year INT NOT NULL ); @@ -18,11 +18,11 @@ CREATE TABLE member ( ); CREATE TABLE loan ( - isbn INT REFERENCES book(isbn), + isbn BIGINT REFERENCES book(isbn), member_id INT REFERENCES member(member_id), loan_date DATE NOT NULL, return_date DATE NOT NULL, - PRIMARY_KEY(isbn, member_id) + PRIMARY KEY(isbn, member_id) ); SHOW TABLES; @@ -31,8 +31,8 @@ SHOW TABLES; ### Insert at least 3 books and 2 members INSERT INTO book VALUES (9781927077030, 'The Three Principles of the People - San Min Chu I', 'Sun Yat-Sen', 2011), - (9780717802418, 'The Communist Manifesto', 'Karl Marx, Friedrich Engels', ''), - (9780131103627, 'C Programming Language, 2nd Edition', 'Brian W. Kernighan, Dennis M. Ritchie'); + (9780717802418, 'The Communist Manifesto', 'Karl Marx, Friedrich Engels', 1848), + (9780131103627, 'C Programming Language, 2nd Edition', 'Brian W. Kernighan, Dennis M. Ritchie', 1988); INSERT INTO member VALUES (10000001, 'Winnie The Pooh', 'winniethepooh@gmail.com'), @@ -44,15 +44,15 @@ SELECT * FROM member; ### Insert 2 loans INSERT INTO loan VALUES (9780131103627, 10000001, '2025-09-11', '2025-09-14'), - (9781927077030, 10000002, '2025-08-10, '2025-10-12') + (9781927077030, 10000002, '2025-08-10', '2025-10-12'); SELECT * FROM loan; ### Select all loans with member name and book title (JOIN) SELECT B.title, M.name -FROM loans L -INNER JOIN book B ON B.isbn = L.isbn, -INNER JOIN member M ON M.member_id = L.member_id; +FROM loan L +INNER JOIN book B ON L.isbn = B.isbn +INNER JOIN member M ON L.member_id = M.member_id; ### Update one Loan's ReturnDate UPDATE loan @@ -67,7 +67,7 @@ SELECT * FROM loan; ### Delete one loan record DELETE FROM loan WHERE - isbn = 9870131103627 + isbn = 9780131103627 AND member_id = 10000001; diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222324.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222324.png new file mode 100644 index 0000000..4db0eb9 Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222324.png differ diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222351.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222351.png new file mode 100644 index 0000000..0dbc184 Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222351.png differ diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222415.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222415.png new file mode 100644 index 0000000..4dd5228 Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_222415.png differ diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223240.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223240.png new file mode 100644 index 0000000..70ecf7c Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223240.png differ diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223301.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223301.png new file mode 100644 index 0000000..7ba94ef Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223301.png differ diff --git a/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223734.png b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223734.png new file mode 100644 index 0000000..f00a92f Binary files /dev/null and b/fall-2025/sen-209/labs/Session4/screenshot/Screenshot_20250915_223734.png differ diff --git a/fall-2025/sen-210/Homework/Session2/Homework for Week 2 - SEN-210 - Thanawin Pattanaphol.pdf b/fall-2025/sen-210/Homework/Session2/Homework for Week 2 - SEN-210 - Thanawin Pattanaphol.pdf new file mode 100644 index 0000000..d6e8a0d Binary files /dev/null and b/fall-2025/sen-210/Homework/Session2/Homework for Week 2 - SEN-210 - Thanawin Pattanaphol.pdf differ