Question

In: Computer Science

Using MySQL Workbench to write and run the following steps, and take a screenshot for me!...

Using MySQL Workbench to write and run the following steps, and take a screenshot for me!

Create a species table and a specimen table.

In the species table, include attributes that reflect the name of the species, a general description of the species, and any other attributes you feel relevant.

In the specimens table, include an ID for the specimen, a reference to the species which it is, the date which it was observed, and any relevant details like height, weight, location, or whatever else you think appropriate.

Select appropriate data types and constraints.

Save the SQL commands for creating the tables as text to include in your lab report. Also, run these commands to create the tables in your database.

Additionally, include an ALTER TABLE ADD and an ALTER TABLE MODIFY command. Make sure these are reasonable for your database and run them as well.

Solutions

Expert Solution

I am using 'student' Database. Replace it with the name of database you like.

1) creating table species.

COMMAND: USE student;
CREATE TABLE species
(
   species_name VARCHAR(30) NOT NULL,
   description VARCHAR(100),
    species_abbreviations VARCHAR(10),
    PRIMARY KEY(species_name)
);

2) Checking table created or not by showing the table.

COMMAND: SELECT * FROM species;

3) Creating table specimen.

COMMAND:

USE student;
CREATE TABLE specimens
(
   specimen_id INT NOT NULL,
    species_nam VARCHAR(30),
    height INT,
    weight INT,
    location VARCHAR(30),
  
    PRIMARY KEY (specimen_id),
  
    FOREIGN KEY (species_nam)
    REFERENCES species(species_name)
);

4) Checking table specimen created or not by showing the table.

COMMAND : SELECT * FROM specimens;

5)ALTER TABLE ADD: For this we are adding a column to species table named 'identifiaction_code'.

COMMAND :

ALTER TABLE species
ADD identification_code INT;

6) Checking whether the column is added or not by showing the table.

COMMAND : SELECT * FROM species;

7) ALTER TABLE MODIFY : For this command we are changing the datatype of 'identification_code' in table species from Int to varchar.

COMMAND :

ALTER TABLE species
MODIFY COLUMN identification_code VARCHAR(10);

8) To check successful modification took place or not we describe the table.

COMMAND : DESCRIBE species;

Ask any doubts if you have in comment section below.

Please rate the answer


Related Solutions

In MySql, using Application MYSQL Workbench and the Chinook database, please answer the following: -- 12....
In MySql, using Application MYSQL Workbench and the Chinook database, please answer the following: -- 12. SELECT the trackid, name and filesize (as shown in the bytes column) for all tracks that have a file size less than 2000000 and a GenreId of 1 or a file size less than 2000000 and a Genreid of 2 -- 13. Add a sort to the query from number 12 to sort by GenreID; -- 14. List all columns from the customer table...
This is in MySQL Part one: Using the MySQL Workbench Data Modeler, construct a diagram that...
This is in MySQL Part one: Using the MySQL Workbench Data Modeler, construct a diagram that shows the table in 3rd Normal Form. Part two: Provide a summary of the steps you took to achieve 3rd Normal form. Include your rationale for new table creation, key selection and grouping of attributes. Table Details: The Anita Wooten Art Gallery wishes to maintain data on their customers, artists and paintings. They may have several paintings by each artist in the gallery at...
Use Workbench/Command Line to create the commands that will run the following queries/problem scenarios. Use MySQL...
Use Workbench/Command Line to create the commands that will run the following queries/problem scenarios. Use MySQL and the Colonial Adventure Tours database to complete the following exercises. 1. List the last name of each guide that does not live in Massachusetts (MA). 2. List the trip name of each trip that has the type Biking. 3. List the trip name of each trip that has the season Summer. 4. List the trip name of each trip that has the type...
Design and implement a relational database application of your choice using MS Workbench on MySQL a)...
Design and implement a relational database application of your choice using MS Workbench on MySQL a) Declare two relations (tables) using the SQL DDL. To each relation name, add the last 4 digits of your Student-ID. Each relation (table) should have at least 4 attributes. Insert data to both relations (tables); (15%) b) Based on your expected use of the database, choose some of the attributes of each relation as your primary keys (indexes). To each Primary Key name, add...
Using WORKBENCH: 1. Create the database below via an ER Diagram in Workbench (take screen shots...
Using WORKBENCH: 1. Create the database below via an ER Diagram in Workbench (take screen shots of the diagram) 2. Go to the database table view and take a screen shot of the table(s) 3. Go to the data entry tool and enter at least three lines of data (in each table). Take screen shots. Create a database that is in third normal form for the following: You are a nerd and have decided to organize your comic books in...
Using the world_x database you installed on your MySQL Workbench, create a new table named “independence”...
Using the world_x database you installed on your MySQL Workbench, create a new table named “independence” with the following attributes (columns): A field named “id” which has data type auto_increment, A field named “country_name” which has data type varchar(50), and A field named “independence_date” which has type “date.” After you create the table, run the following SQL command: INSERT INTO independence(country_name, independence_date) VALUE (‘United States’,’1776-07-04’) Submit a 1-page Microsoft Word document that shows the following: The SQL command you used...
Develop a C++/Python program using visual studio connected to mysql workbench to show all vendor's name...
Develop a C++/Python program using visual studio connected to mysql workbench to show all vendor's name and phone (vendor_name and vendor_phone) in the state "CA" and the city "Los Angeles". here is the database tables CREATE TABLE general_ledger_accounts ( account_number INT PRIMARY KEY, account_description VARCHAR(50) UNIQUE ); CREATE TABLE terms ( terms_id INT PRIMARY KEY AUTO_INCREMENT, terms_description VARCHAR(50) NOT NULL, terms_due_days INT NOT NULL ); CREATE TABLE vendors ( vendor_id INT PRIMARY KEY AUTO_INCREMENT, vendor_name VARCHAR(50) NOT NULL UNIQUE, vendor_address1...
-Using MySQL Workbench Data Modeler, create three (3) models from the tables below. Show Table 1...
-Using MySQL Workbench Data Modeler, create three (3) models from the tables below. Show Table 1 in 3rd Normal Form. Show Table 2 in 3rd Normal Form. Merge the 3rd Normal Forms of Table 1 and Table 2 into a single 3rd Normal Form model. Note that you only can model table and column names and data types. The data shown is for your reference to determine functional, partial, and transitive dependencies. -Provide a summary of the steps you took...
Hello, Please give me step by step answer (with screenshot) of SPSS using the ANOVA program...
Hello, Please give me step by step answer (with screenshot) of SPSS using the ANOVA program to answer the following question. Chegg gave different answers. A researcher would like to find out whether a particular diet affects a person’s cholesterol reading. She records the cholesterol readings of 23 men who ate cow meat for dinner every night, 24 men who ate chicken and 19 men who ate pig; her data appears in the table to the right. She wants to...
2. Run the following C program, and submit the screenshot of the result. Also briefly explain...
2. Run the following C program, and submit the screenshot of the result. Also briefly explain the result. #include <sys/types.h> #include <stdio.h> #include <unistd.h> #define SIZE 5 int nums[SIZE] = {0,1,2,3,4}; int main() { int i; pid_t pid; pid = fork(); if (pid == 0) { for (i = 0; i < SIZE; i++) { nums[i] *= -i; printf("CHILD: %d ",nums[i]); /* LINE X */ } } else if (pid > 0) { wait(NULL); for (i = 0; i <...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT