Something Important.. if you have a MacBook Pro..
I had to download MAMP .
Be sure to put it in your Applications folder after you extract it.
In your finder search bar type in "terminal"
Open your terminal window…Type this in
mysql -uroot -p
It will ask for your password and it should be root unless you have changed it..
The first assignment: Create a mySQL script in the command prompt( terminal window.. that will create a database, and table for student information. Include at least five fields, and at least five rows of data. Also include an ability to display all the records at the end of the script.Turn In:
1. The script itself
2. A screen shot showing the output of the script when run
Assignment 3.sql
CREATE DATABASE cist_Students;
USE cist_Students;
CREATE TABLE my_Students (
id INT PRIMARY KEY,
firstName VARCHAR (15),
lastName VARCHAR(15),
email VARCHAR(20),
phone VARCHAR(15),
major VARCHAR (15),
gpa VARCHAR (3)
);
INSERT INTO my_Students VALUES (
0, 'steve', 'smith', 'this@that.com', '455-4543',' nurse' , '3'),
(1, 'deanna', 'dobbibs', 'she@that.com', '545-4543',' programming' , '4.0'),
(2, 'lucy', 'jones', 'lucy@that.com', '645-4543',' art' , '3.0'),
(3, 'aubie', 'eagle', 'eagle@that.com', '895-4543',' sports' , '3.5'),
(4, 'robert', 'hairman', 'weagle@that.com', '998-4543',' history' , '3.0');
SELECT * FROM my_Students;
This is what it will look like in the terminal window on the mac:
When you open up phpmyadmin and go to your database and choose the table you created, you will see the data inserted. TADA the magic of SQL :-)
Restoring database files at home or in the classroom
Using CD to get to the bin location as shown in the backup directions.
Then execute:
mysql -u root -p -D mydatabase < mydatabase.sql
The program will prompt you for a password..just hit enter
You will not recieve any message back. However, you should be able to go into phpmyadmin and see the results.
Using CD to get to the bin location as shown in the backup directions.
Then execute:
mysql -u root -p -D mydatabase < mydatabase.sql
The program will prompt you for a password..just hit enter
You will not recieve any message back. However, you should be able to go into phpmyadmin and see the results.
No comments:
Post a Comment