Follow below commands and try them on you local machine!
Create a database named "Campus" in MySQL, you can use the following SQL query:
CREATE DATABASE IF NOT EXISTS Campus;
SHOW DATABASES;
This will list all databases, including "Campus" if it was successfully created.
Create the tables "Students", "Faculty", and "Course" under the "Campus" database in MySQL, you can use the following SQL queries. Each table includes relevant columns and data types.
USE Campus;
CREATE TABLE IF NOT EXISTS Students (
StudentID INT AUTO_INCREMENT PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
DateOfBirth DATE,
Email VARCHAR(100) UNIQUE
);
CREATE TABLE IF NOT EXISTS Faculty (
FacultyID INT AUTO_INCREMENT PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
Department VARCHAR(100),
Email VARCHAR(100) UNIQUE
);
CREATE TABLE IF NOT EXISTS Course (
CourseID INT AUTO_INCREMENT PRIMARY KEY,
CourseName VARCHAR(100) NOT NULL,
Credits INT CHECK (Credits > 0),
FacultyID INT,
FOREIGN KEY (FacultyID) REFERENCES Faculty(FacultyID)
);
n
.