Create a new database in MySQL called horsestable. List the databases in MySql.
ID: 3750018 • Letter: C
Question
Create a new database in MySQL called horsestable. List the databases in MySql. Result set should look like:
Change to us the database horsestable.
Show the current tables in database horsestable. Result set should look like:
ID, integer, not null, auto increment
registered name, variable character - 15 characters
barn name, variable character – 20 characters, not null
breed, variable character – 20 characters
age, int
height, three numbers with one to the right of the decimal point
start date, date, not null
primary key is the ID field
ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
address, variable character – 30 characters, not null
city, variable character – 20 characters, not null
state, character – 2 characters
zip, int, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
primary key is the ID field
Create a table in database horsestable called student with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
primary key is the ID field
Create a table in database horsestable called grain with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
manufacturer, variable character - 30 characters, not null
product, variable character – 30 characters, not null
weight, integer
Cost, decimal with 5 values, 2 to the right of the decimal point, not null
primary key is the ID field
ID, integer, not null, auto increment
type, enumeration with values of 'Coastal','Timothy','Orchard','Alfalfa','Peanut','Bermuda','Oat','Barley'
size, enumeration with values of 'Two string', 'Three string'
Cost, decimal with 5 values, 2 to the right of the decimal point, not null
Weight, integer, not null
primary key is the ID field
ID, integer, not null, auto increment
type, enumeration with values of 'Pellets', 'Shavings', 'Straw'
size, integer
primary key is the ID field
Create a table in database horsestable called staff with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
primary key is the ID fiel/d
stall_id, integer, not null, auto increment
stall_number, enumeration with values of 1,2,3,4,5,6,7,8,9,10
base_price, floating point, not null, 5 digits, 2 digits to the right of the decimal point
primary key is the stall_id field
pasture_id, integer, not null, auto increment
pasture_number, enumeration with values of 1,2,3,4
base_price, floating point, not null, 5 digits, 2 digits to the right of the decimal point
primary key is the pasture_id field
Perform test cases in table below. Use whatever screenshot program your computer has to provide the output.
Create a new database in MySQL called horsestable. List the databases in MySql. Result set should look like:
Change to us the database horsestable.
Show the current tables in database horsestable. Result set should look like:
Create a table in database horsestable called horse with the following attributes, data types, and constraints:ID, integer, not null, auto increment
registered name, variable character - 15 characters
barn name, variable character – 20 characters, not null
breed, variable character – 20 characters
age, int
height, three numbers with one to the right of the decimal point
start date, date, not null
primary key is the ID field
Create a table in database horsestable called boarder with the following attributes, data types, and constraints:ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
address, variable character – 30 characters, not null
city, variable character – 20 characters, not null
state, character – 2 characters
zip, int, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
primary key is the ID field
Create a table in database horsestable called student with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
primary key is the ID field
Create a table in database horsestable called grain with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
manufacturer, variable character - 30 characters, not null
product, variable character – 30 characters, not null
weight, integer
Cost, decimal with 5 values, 2 to the right of the decimal point, not null
primary key is the ID field
Create a table in database horsestable called hay with the following attributes, data types, and constraints:ID, integer, not null, auto increment
type, enumeration with values of 'Coastal','Timothy','Orchard','Alfalfa','Peanut','Bermuda','Oat','Barley'
size, enumeration with values of 'Two string', 'Three string'
Cost, decimal with 5 values, 2 to the right of the decimal point, not null
Weight, integer, not null
primary key is the ID field
Create a table in database horsestable called bedding with the following attributes, data types, and constraints:ID, integer, not null, auto increment
type, enumeration with values of 'Pellets', 'Shavings', 'Straw'
size, integer
cost, decimal with 5 values, 2 to the right of the decimal point, not nullprimary key is the ID field
Create a table in database horsestable called staff with the following attributes, data types, and constraints:
ID, integer, not null, auto increment
first name, variable character - 20 characters, not null
last name, variable character – 30 characters, not null
primary phone, character – 10 characters, not null
email address, variable character – 30 characters
type, enumeration with values of Trainer, Groom, Barn Staff, Maintenanceprimary key is the ID fiel/d
Create a table in database horsestable called stall with the following attributes, data types, and constraints:stall_id, integer, not null, auto increment
stall_number, enumeration with values of 1,2,3,4,5,6,7,8,9,10
base_price, floating point, not null, 5 digits, 2 digits to the right of the decimal point
primary key is the stall_id field
Create a table in database horsestable called pasture with the following attributes, data types, and constraints:pasture_id, integer, not null, auto increment
pasture_number, enumeration with values of 1,2,3,4
base_price, floating point, not null, 5 digits, 2 digits to the right of the decimal point
primary key is the pasture_id field
Perform test cases in table below. Use whatever screenshot program your computer has to provide the output.
Explanation / Answer
If you have any doubts, please give me comment...
CREATE Database horsestable;
SHOW DATABASES;
USE horsestable;
SHOW TABLES;
CREATE TABLE horse(
IND INT NOT NULL AUTO_INCREMENT,
registered_name VARCHAR(15),
barn_name VARCHAR(20) NOT NULL,
breed VARCHAR(20),
age INT,
height DECIMAL(1,2),
start_date DATE NOT NULL,
PRIMARY KEY(ID)
);
CREATE TABLE boarder(
ID INT NOT NULL AUTO_INCREMENT,
firstname VARCHAR(20) NOT NULL,
lastname VARCHAR(30) NOT NULL,
address VARCHAR(30) NOT NULL,
city VARCHAR(20) NOT NULL,
state CHAR(2),
zip INT NOT NULL,
primary_phone CHAR(10) NOT NULL,
email_address VARCHAR(30),
PRIMARY KEY(ID)
);
CREATE TABLE student(
ID INT NOT NULL AUTO_INCREMENT,
firstname VARCHAR(20) NOT NULL,
lastname VARCHAR(30) NOT NULL,
primary_phone CHAR(10) NOT NULL,
email_address VARCHAR(30),
PRIMARY KEY(ID)
);
CREATE TABLE grain(
ID INT NOT NULL AUTO_INCREMENT,
manufacturer VARCHAR(30) NOT NULL,
product VARCHAR(30) NOT NULL,
weight INT,
Cost DECIMAL(5, 2) NOT NULL,
PRIMARY KEY(ID)
);
CREATE TABLE hay(
ID INT NOT NULL AUTO_INCREMENT,
type ENUM('Coastal','Timothy','Orchard','Alfalfa','Peanut','Bermuda','Oat','Barley'),
size ENUM('Two string', 'Three string'),
Cost DECIMAL(5, 2) NOT NULL,
Weight INT NOT NULL,
PRIMARY KEY(ID)
);
CREATE TABLE bedding(
ID INT NOT NULL AUTO_INCREMENT,
type ENUM('Pellets', 'Shavings', 'Straw'),
size INT,
Cost DECIMAL(5, 2) NOT NULL,
PRIMARY KEY(ID)
);
CREATE TABLE staff(
ID INT NOT NULL AUTO_INCREMENT,
firstname VARCHAR(20) NOT NULL,
lastname VARCHAR(30) NOT NULL,
primary_phone CHAR(10) NOT NULL,
email_address VARCHAR(30),
type ENUM('Trainer', 'Groom', 'Barn Staff', 'Maintenance'),
PRIMARY KEY(ID)
);
CREATE TABLE stall(
stall_id INT NOT NULL AUTO_INCREMENT,
stall_number ENUM(1,2,3,4,5,6,7,8,9,10),
base_price DECIMAL(5,2),
PRIMARY KEY(stall_id)
);
CREATE TABLE pasture(
pasture_id INT NOT NULL AUTO_INCREMENT,
pasture_nummber ENUM(1,2,3,4),
BASE_PRICE DECIMAL(5,2),
PRIMARY KEY(pasture_id)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.