Professional Documents
Culture Documents
Reyes Kier Christian Activity Ccs110 Midterm Period
Reyes Kier Christian Activity Ccs110 Midterm Period
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Code ScreenShots
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Code Output
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Sample Code
CREATE TABLE orderTally
(order_Id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
customer_Fullname VARCHAR(50) NOT NULL,
sex ENUM('M', 'F') NOT NULL,
city VARCHAR (40) NOT NULL,
zip MEDIUMINT UNSIGNED NOT NULL,
phone VARCHAR(20) NOT NULL,
item_purchased VARCHAR(30) NOT NULL,
item_cost FLOAT NULL,
date_purchased TIMESTAMP
);
DESCRIBE orderTally;
INSERT INTO orderTally(customer_Fullname, sex, city, zip,
phone, item_purchased, item_cost, date_purchased) VALUES
('Addisyn Santiago', 'F', 'Albuquerque', 87101, 946984,
'iPhone 15 Plus', 899.00, NOW()),
('Valentino Stuart','F', 'San Francisco', 94107, 293764,
'iPhone SE', 429.00, NOW()),
('Katie Prince', 'F', 'Detroit', 48204, 738654, 'iPhone 14',
699.00, NOW()),
('Alejandro Noble', 'M', 'Salt Lake City', 84102, 103453,
'iPhone 15 Pro Max', 1599.00, NOW()),
('Hailey Herrera', 'F', 'Jersey City' , 07032, 983201,
'iPhone 15', 799.00, NOW()),
('Dane Lam', 'M', 'Oakland' , 94505, 543421, 'iPhone 15 Pro',
999.00, NOW()),
('Maximo Burns', 'M', 'Kansas City', 64109, 843512, 'iPhone
13', 599, NOW()),
('Zaylee Bradshaw', 'F', 'Detroit', 48206, 732145, 'iPhone 14
Plus', 799.00, NOW()),
('Royal Paul', 'M', 'San Francisco', 94108, 287546, 'iPhone
15 Pro', 999.00, NOW()),
('Ainsley Dominguez', 'F', 'Kansas City', 64106, 874352,
'iPhone 14', 699.00, NOW()),
('Peyton Lang', 'F', 'Oakland', 94509, 546732, 'iPhone 15',
799.00, NOW()),
('Addisyn Santiago', 'F', 'Jersey City', 07032, 342154,
'iPhone SE', 429.00, NOW()),
('Valentino Stuart', 'F', 'Albuquerque', 87103, 946537,
'iPhone SE', 429.00, NOW());
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Code ScreenShots
o Using ‘AND’ and ‘OR’
o Using ‘XOR’ and ‘NOT’ (exclusive or returns the reverse of AND and
NOT in the above, since both conditional statements are true (If both
T = F).
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Code Output
o USING ‘AND’ and ‘OR’
o Using ‘XOR’ and ‘NOT’ (exclusive or returns the reverse of AND and
NOT in the above, since both conditional statements are true (If both
T = F).
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Sample Code
SELECT customer_Fullname, item_purchased, item_cost FROM
orderTally
WHERE (city = 'Albuquerque' OR city = 'Salt Lake City') AND
(item_cost < 2699.00 AND item_cost > 399.00) ORDER BY
item_cost DESC;
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Using the tables that was created from the previous activity, use IN and BETWEEN
combine with the AND, OR and NOT Operator.
o Using ‘IN’ and ‘AND’ (It ignores the other Valentino that is duplicate since it only
retrieves zip codes that starts with value 9);
o Using ‘IN’ and ‘OR’ (At least one needs to be true so this returns the first
condition output.)
Republic of the Philippines
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
Sample Code
-- USING IN and AND
SELECT customer_Fullname, item_purchased, item_cost FROM
orderTally
WHERE city IN ('Oakland', 'San Francisco') AND zip LIKE '9%';
-- USING IN and OR
SELECT customer_Fullname, item_purchased, item_cost, zip FROM
orderTally
WHERE city IN ('Kansas City', 'Salt Lake City') OR item_cost
>= 1000;
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
USE lgOperators;
DESCRIBE orderTally;
University of Cabuyao
('Valentino Stuart', 'F', 'Albuquerque', 87103, 946537,
(Pamantasan
'iPhone SE', 429.00, NOW()); ng cabuyao)
COLLEGE OF COMPUTING STUDIES
SELECTKatapatan
customer_Fullname, item_purchased, item_cost FROM
Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025
orderTally
WHERE (city = 'Albuquerque' OR city = 'Salt Lake City') AND
(item_cost < 2699.00 AND item_cost > 399.00) ORDER BY
item_cost DESC;
= 'iPhone SE';
University of Cabuyao
(Pamantasan ng cabuyao)
COLLEGE OF COMPUTING STUDIES
Katapatan Mutual Homes, Brgy. Banay-banay, City of Cabuyao, Laguna 4025