CREATE TABLE Guest(
GuestCardNumber VARCHAR(20) PRIMARY KEY,
Name VARCHAR(10),
CheckInTime DATETIME,
VIPStatus INT CHECK (VIPStatus IN (0,1)) -- Integer 1 = VIP 0 = Regular
);
INSERT INTO Guest (GuestCardNumber, Name, CheckInTime, VIPStatus)
VALUES
('GC001', 'Alice', '2025-10-01 14:30:00', 1),
('GC002', 'Bob', '2025-10-01 15:00:00', 0),
('GC003', 'Charlie', '2025-10-01 15:45:00', 1),
('GC004', 'Diana', '2025-10-01 16:10:00', 0),
('GC005', 'Ethan', '2025-10-01 16:30:00', 1);
-- Display the names from all VIP guests
SELECT Name
FROM Guest
WHERE VIPStatus = 1;
-- Aggregate function appear in a SELECT clause and process all rows that satisfy the WHERE clause Condition
-- if a SELECT statement has no WHERE clause the aggregate function processes all rows.
-- Common aggregate functions are:
-- COUNT() Counts the number of rows in the set
-- MIN() finds the minimum value in the set
-- MAX() finds the maximum value in the set
-- SUM() sums all the values in the set
-- AVG() computes the arithmetic mean of all the values in the set.
To embed this project on your website, copy the following code and paste it into your website's HTML: