Question

In: Computer Science

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 to create the “independence” table and a list of the rows in the “independence” table.

Explain the purpose of the field named “id.” Why do you not have to include it in an insert statements? How would change the incrementing value to a number greater than one?

Solutions

Expert Solution

Solution:-

use world_x;

CREATE TABLE independence (

    id int NOT NULL AUTO_INCREMENT,

    country_name varchar(50),

    independence_date date,

    PRIMARY KEY (id)

);

INSERT INTO independence(country_name, independence_date)

VALUE (‘United States’,’1776-07-04’);

================
 
Explain the purpose of the field named “id.” =>
The id field is unique identifier, through which we identify the records in the independence table. So if row1 corresponds to id=1, row 2 as id=2, then we can select the records just using the ids.
 
Why do you not have to include it in an insert statements? =>
As id column is auto-increment, it means, each time a record is inserted, system itself will assign it a id, which is one more than the last assigned id.
 
How would change the incrementing value to a number greater than one? => 
SET @@auto_increment_increment=2;
Above statement will increment the ids using number 2 each time.

Related Solutions

This refer to the “om” database (or Schema) that you will find in your MySQL Workbench...
This refer to the “om” database (or Schema) that you will find in your MySQL Workbench program if you have run the sample database install script. Please save all of your answers in one script (.sql) or type all your answers into Notepad++ and submit them as a single .sql file. Please test your SQL statements in Workbench 1.       Using an INNER JOIN, select the order_id, order_date, shipped_date, fname, and customer_phone from the orders and customers tables. The fname is a...
Part 2: Use MySQL Workbench to add a table to your database on the class server...
Part 2: Use MySQL Workbench to add a table to your database on the class server and name the table “Person”. Include these fields in the Person table: Field Name Description Data Type Sample Value LoginID User’s login name varchar(10) Bob FirstName User’s first name varchar(50) Bob LastName User’s last name varchar(50) Barker picUrl Filename of the user’s picture varchar(50) bob.gif Bio User’s biography varchar(255) Bob is the best! LoginID should be the Primary Key of the table. Add at...
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...
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 sample.sql script, create the sample database in MySQL. Submit the MySQL interactive screen that...
Using the sample.sql script, create the sample database in MySQL. Submit the MySQL interactive screen that results. create database sample; use sample; create table customer (custno int auto_increment primary key, firstname varchar(20), middle varchar(20), lastname varchar(20), address varchar(60), telnum1 varchar(10), telnum2 varchar(10), telnum3 varchar(10), pin varchar(6), email varchar(30)); create table accttype (id int primary key, type varchar(10)); insert into accttype (id, type) values (1,'check'); insert into accttype (id, type) values (2,'save'); insert into accttype (id, type) values (3,'cd'); insert into...
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...
Using MySQL 8.xx create a database with the following characteristics. . A. Your design MUST meet...
Using MySQL 8.xx create a database with the following characteristics. . A. Your design MUST meet the requirements for Third Normal Form B. Create a database (you will need multiple tables) to store employee information. This information will include: Employee Number, First Name, Last Name, Date of birth, Address, city, state, zip, department, job title, supervisor, health insurance number, health insurance provider, dental insurance number, dental insurance provider, spouse/partner, children, children's ages. C. Populate the table with multiple records which...
Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based on your entities defining The attributes within each table The primary and foreign keys within each table *****Show your database tables, tables attributes, primary and foreign keys***** Do not forget to check the lesson slides and videos that show you how to convert an ER/EER into a database schema, and how to create a database and tables using MS SQL Server.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT