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...
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...
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...
without using excel can someone show me the steps to approach the following question Question 2...
without using excel can someone show me the steps to approach the following question Question 2 Rump Industries Ltd expects its new product will give it a significant first mover advantage in the market and that is expected to provide growth in earnings per share of 400% within the coming year, and 75% growth in each of the subsequent 3 years. After that time, it is expected competitors will have developed and brought to market similar products with the result...
write me all steps ,please. A particle of mass m is in the ground state of...
write me all steps ,please. A particle of mass m is in the ground state of an infinite potential energy well of width L. The energy of the particle is 2.0 eV (a) How much energy must be added to the particle to cause it to jump to the first excited state? [ show your solution] (1) 2.0 eV             (2) 4.0 eV              (3) 6.0 eV                  (4) 8.0 eV (b) Suppose the particle is in the second excited state (n =...
Write a log-in log-out session using PHP, CSS, and HTML only. NO MYSQL and JavaScript allowed....
Write a log-in log-out session using PHP, CSS, and HTML only. NO MYSQL and JavaScript allowed. 1. Need an HTML form and a login form; separate file. 2. need a CSS file to make it look good 3. Must store visitors' info in a .txt file and validate from there if the user exists before granting access to the dashboard. If the user does not exist, render the form to signup. If the user exists take them to their dashboard....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT