/home/your_login/exercises_done/ex7/exercises.txt
mysql -u <your login> -h dictator samp_db
Movies.sd.com is a web site which allows users to find all the movies currently playing in San Diego based on a set of user preferences. These user preferences include the title of the movie, the time it's playing, and the movie theater it's playing at. Design a schema for the database that would store this information. Use just one table.
SELECT first_name, last_name, email
FROM member
WHERE state = 'CA';
SELECT *
FROM member
WHERE email like '%@pluto.com';
SELECT *
FROM member
WHERE expiration > '2002-08-11';
SELECT *
FROM member
WHERE email like '%@pluto.com' AND expiration > '2002-08-11';
SELECT *
FROM member
WHERE email like '%@pluto.com' OR expiration > '2002-08-11';
mysql -u ssmallen -h dictator ssmallen_db
CREATE TABLE hiking( trail CHAR(50), area CHAR(50),
distance FLOAT, est_time FLOAT );
Put results for the following commands into exercises.txt:
show tables:
show columns from hiking:
INSERT INTO hiking
VALUES( 'Cedar Creek Falls', 'Upper San Diego River', 4.5, 2.5 );
INSERT INTO hiking (trail, area )
VALUES ( 'East Mesa Loop', 'Cuyamaca Mountains' );
Put results for the following commands into exercises.txt:
select * from hiking
UPDATE hiking
SET distance = 10.5, est_time = 5.5
WHERE trail = 'East Mesa Loop';
Put results of select * from hiking into exercises.txt:
DELETE FROM hiking
WHERE trail = 'Cedar Creek Falls';
Put results of select * from hiking into exercises.txt:
+------------------------+--------------------+----------+----------+ | trail | area | distance | est_time | +------------------------+--------------------+----------+----------+ | East Mesa Loop | Cuyamaca Mountains | 10.50 | 5.50 | | Oak Canyon | NULL | 3.00 | NULL | +------------------------+--------------------+----------+----------+
+------------------------+------------------------------+----------+----------+ | trail | area | distance | est_time | +------------------------+------------------------------+----------+----------+ | East Mesa Loop | Cuyamaca Mountains | 10.50 | 5.50 | | Oak Canyon | Mission Trails Regional Park | 3.00 | 2.00 | +------------------------+------------------------------+----------+----------+
Give the SQL statement to delete trails with a distance greater than 5 miles.
Give the SQL statement to create a table called 'rating'. This table rates the difficulty of a hiking trail. It will have two columns: the trail name, 'trail' and the difficulty, 'difficulty'. The trail name is a string of no more than 50 characters and the difficulty is an integer (INT).
Put the results of show tables into exercises.txt
Put the results of show columns from rating into exercises.txt