Question
1. Install XAMPP on your system. 2. Start the MySQL/MariaDB Server locally installed on your laptop, as part of the XAMPP install. 3: Connect to
1. Install XAMPP on your system.
2. Start the MySQL/MariaDB Server locally installed on your laptop, as part of the XAMPP install.
3: Connect to MySQL server. Open a command line on your system, Windows (DOS Prompt) and OSX (Console). Type in: mysql -h localhost -u root -p . NOTE: this connects you to your localhost where you have installed xampp server.
4. At the command line, type MySQL command and create a database and name it "yourlastnameStudents". Note that commands are not case sensitive. NOTE: The database you create is in this folder: xampp \ mysql \ data
CREATE DATABASE named as: yourlastnameStudents; when you create database a folder with the database name is created which stores all the related files including tables in this folder.
5. Make "yourlastnameStudents" database your current database and create three tables in this database.
USE yourlastnameStudents;
6. The three tables are: students, modules, grades.
7. Type the following statements to create the tables and their fields (columns) with their type and size in each table.
CREATE TABLE students ( student_no varchar(10), lastname varchar(20), firstname varchar(20)); CREATE TABLE modules ( module_code varchar(8), module_name varchar(20)); CREATE TABLE grades ( student_no varchar(10), module_code varchar(8), mark integer);
8. To see the listing of the fields in each table:
DESCRIBE
9. Populate each table using the following statements:
INSERT INTO students VALUES ('20060101','Greek','Pluto'); INSERT INTO students VALUES ('20060102','Lovelace','Ada'); INSERT INTO students VALUES ('20060103','Ritchie','Dennis'); INSERT INTO students VALUES ('20060104','Hopper','Grace'); INSERT INTO students VALUES ('20060105','Wozniak','Steve'); INSERT INTO modules VALUES ('CM0001', 'Databases'); INSERT INTO modules VALUES ('CM0002', 'Programming Lang'); INSERT INTO modules VALUES ('CM0003', 'Operating Systems'); INSERT INTO modules VALUES ('CM0004', 'Graphics'); INSERT INTO grades VALUES ('20060101', 'CM0001', 80); INSERT INTO grades VALUES ('20060101', 'CM0002', 65); INSERT INTO grades VALUES ('20060101', 'CM0003', 90); INSERT INTO grades VALUES ('20060102', 'CM0001', 75); INSERT INTO grades VALUES ('20060102', 'CM0003', 79); INSERT INTO grades VALUES ('20060102', 'CM0004', 70); INSERT INTO grades VALUES ('20060103', 'CM0001', 60); INSERT INTO grades VALUES ('20060103', 'CM0002', 75); INSERT INTO grades VALUES ('20060103', 'CM0004', 60); INSERT INTO grades VALUES ('20060104', 'CM0001', 55); INSERT INTO grades VALUES ('20060104', 'CM0002', 76); INSERT INTO grades VALUES ('20060104', 'CM0003', 87); INSERT INTO grades VALUES ('20060105', 'CM0001', 55); INSERT INTO grades VALUES ('20060105', 'CM0002', 64); INSERT INTO grades VALUES ('20060105', 'CM0004', 65);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started