Created
September 24, 2023 08:14
-
-
Save kunxin-chor/5ffede92fea9cfe0dcb5dc509270bddf to your computer and use it in GitHub Desktop.
MySQL Database for Pet Hospital
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Check if the database exists, if not, create it | |
CREATE DATABASE IF NOT EXISTS pet_hospital; | |
USE pet_hospital; | |
-- Create the `pets` table | |
CREATE TABLE IF NOT EXISTS pets ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
species VARCHAR(255) NOT NULL, | |
breed VARCHAR(255) DEFAULT NULL, | |
age INT DEFAULT NULL, | |
owner_name VARCHAR(255) NOT NULL, | |
owner_contact VARCHAR(255) NOT NULL, | |
last_visit DATE DEFAULT NULL, | |
notes TEXT | |
); | |
-- Insert some sample rows | |
INSERT INTO pets (name, species, breed, age, owner_name, owner_contact, last_visit, notes) | |
VALUES | |
('Buddy', 'Dog', 'Golden Retriever', 5, 'John Smith', '555-1234', '2023-09-20', 'Routine check-up.'), | |
('Whiskers', 'Cat', 'Siamese', 3, 'Jane Doe', '555-5678', '2023-08-15', 'Vaccination due next month.'), | |
('Goldie', 'Fish', 'Goldfish', 1, 'Tom Brown', '555-9090', NULL, NULL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment