Question

In: Computer Science

Flag Create a database for PAINTER and PAINTING entities/tables; Decide on your own what will be...

Flag Create a database for PAINTER and PAINTING entities/tables; Decide on your own what will be the attributes of PAINTER and PAINTING tables; Insert at least 5 records on each table Deliverables: Screenshot of PAINTER and PAINTING table structures using the describe command Screenshot of PAINTER and PAINTING table records/entries using select command.

Solutions

Expert Solution

solution:

Step 1: Analysing given entities and adding attributes:

Primary key is bold.

The system will have below entities:

1. PAINTER: This entity is required to store the details of a painter who makes the paintings. It can have below attributes:

PAINTER(PAINTER_ID, NAME, ADDRESS, COUNTRY_OF_ORIGON, CONTACT_NO)

2. PAINTING: This is the entity which stores the details of a paining with below attributes:

PAINING(PAINTING_ID, NAME, COMPLETED_ON, THEME, DESCRIPTION, COST)

Step 2: Relation between the entities:

A PAINTING is painted by one PAINTER, thus PAINTING table will have a foreign key reference from PAINTER table as below:

PAINTING (PAINTING_ID, NAME, COMPLETED_ON, THEME, DESCRIPTION, COST, PAINTED_BY)

Step 3: SQL to create tables:

Please find below the SQL to create database for the given tables:

---------------------------------------------

create database PAINT_AND_PAINTER; /*name of the database */

Use PAINT_AND_PAINTER;

CREATE TABLE PAINTER(PAINTER_ID INT PRIMARY KEY, NAME VARCHAR(100), ADDRESS VARCHAR(100), COUNTRY_OF_ORIGON VARCHAR(50), CONTACT_NO VARCHAR(12));

CREATE TABLE PAINTING (PAINTING_ID VARCHAR(10) PRIMARY KEY, NAME VARCHAR(100), COMPLETED_ON DATE, THEME VARCHAR(10), DESCRIPTION VARCHAR(100), COST double, PAINTED_BY int,

Foreign key (PAINTED_BY) references PAINTER(PAINTER_ID));

---------------------------------------------

Step 4: Insert records in the tables:

Please find below the insert query to insert the data in above tables:

INSERT INTO PAINTER values (1, 'Joe painter', 'ADD, Street 1, City1' , 'UK', '111-222-333');

INSERT INTO PAINTER values (2, 'Nick painter', 'ADD2, Street 2, City2' , 'LA', '222-333-444');

INSERT INTO PAINTER values (3, 'Liza painter', 'ADD3, Street 3, City3' , 'CA', '333-555-666');

INSERT INTO PAINTER values (4, 'Gray painter', 'ADD4, Street 4, City4' , 'US', '666-777-888');

INSERT INTO PAINTER values (5, 'Blue painter', 'ADD5, Street 5, City5' , 'IND', '000-999-888');

INSERT INTO PAINTING values('P1', 'Lonely Paint1', '1990-12-12', 'NATURE', 'DESCRPIOTN NATURE', 15687, 1);

INSERT INTO PAINTING values('P2', 'Happy Paint1', '1980-07-12', 'FAMILY', 'DESCRPIOTN FAMILY', 2605, 2);

INSERT INTO PAINTING values('P3', 'Simple Paint1', '1995-12-02', 'NATURE', 'DESCRPIOTN NATURE', 1150, 3);

INSERT INTO PAINTING values('P4', 'Art Paint1', '1997-05-09', 'PROFESSION', 'DESCRPIOTN PROFESSION', 5620, 5);

INSERT INTO PAINTING values('P5', 'Arling Paint1', '2010-12-01', 'NATURE', 'DESCRPIOTN NATURE', 159, 4);

Step 5: PAINTER and PAINTING table structures using the describe command

Command:

Describe PAINTER;

Describe PAINTING;

Step 5: PAINTER and PAINTING table records/entries using select command

Command:

Select* from PAINTER;

Select* from PAINTING;

please give me thumb up


Related Solutions

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.
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient,...
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient, fullName, biologicalMother, birthdate, address) doctor(idDr, fullName, specialization, consulRates) inpatient(idPatient, entryTime, outTime, idDr, idRoom). Please make entryTime as column that is going to be filled automatically when care record is being add room(idRoom, roomName, cost) fill the data above to each table Create sql query and relational algebra expressions for the query Please give me detailed answer so I could learn from it. Thank you...
Part 2: You will create five tables in your ColonialAdventureTours database. Please do not write your...
Part 2: You will create five tables in your ColonialAdventureTours database. Please do not write your own SQL Commands for this task, use data found in the following Colonial_create.txt file and copy and paste the commands into MySQL workbench. Then add Primary key, Foreign key, and not null constraints appropriately. Then run your codes. Note: Remember that since you enforced referential integrity (foreign key constraints) that you must create the "primary" tables before you can create the "related" tables in...
Write create table statements to create tables for the Exoproduct employees computers database depicted by the...
Write create table statements to create tables for the Exoproduct employees computers database depicted by the relational schema created in a mini case MC5 in chapter 3. Use insert into statements to insert no fewer than 2 and no more than 10 records per table.
Create a database design with the following rules. List down all the entities and attributes and...
Create a database design with the following rules. List down all the entities and attributes and draw out the relationships. List all the business rules. 1. A person can have multiple accounts (Track individual accounts, Trusts, IRA, 401k, HSA, etc) a. Not all accounts must be through brokerage 2. Multiple brokerages (Fidelity, Vanguard, ect) a. Multiple accounts with different brokerages b. Multiple types of accounts allowed at each broker 3. Categorization of investments (Large Cap, mid cap, small cap, Bonds...
Create tables according to the mapping. Add 2 records to each. Create 5 queries for database...
Create tables according to the mapping. Add 2 records to each. Create 5 queries for database of 3 table joins to use most of the tables or group of tables in database. You should not have tables that are of no use. Student(ssn, name, major) Class(classID, name, f_ssn) Faculty(ssn, name, office_num, dept_id) Department(Dept_id, office_num, f_ssn) Enroll(s_ssn, classID, grade) Professor(f_ssn, alma-mater, tenured) Instructor(f_ssn, term_degree, type) Lecture(classID, method) Lab(classID, location) Person(ssn, dob, gender)
SQL code Create entities (tables) to represent the following ternary relationship. Note that we are not...
SQL code Create entities (tables) to represent the following ternary relationship. Note that we are not storing all the required information in these entities to simplify it. The underlined attributes are the primary keys. Don’t forget to set the constraints for primary and foreign keys: •A student entity ( bannerId, first name, last name, date of birth) •A course entity ( crnNumber, course name, # of credits) •An examination entity ( examId, exam_type, exam_date). (exam types can be “Midterm”, “Final”,...
Create first draft for online shopping database (SQL): Things to do: Identify the entities Identify the...
Create first draft for online shopping database (SQL): Things to do: Identify the entities Identify the attributes Constraints Relations First Normal form Second Normal Form Third Normal Form Test Query to: Add a new item as a seller Query for total number of sold item in past month Query for total income in US DOLLARS
Create a database with two tables as follows:- Students - StudentID, Name, Program FeePayment - StudentID,...
Create a database with two tables as follows:- Students - StudentID, Name, Program FeePayment - StudentID, Date, Description, Amount 1. Create a stored procedure that receives all the details of a student including fees and proceeds to insert insert the student details into the student details and the fee payment into the FeePayment table. All the operations should be done within a single transaction in a stored procedure. Note that the stored procedure works like a function that receives parameters....
Please create the following tables for a tool rental database with appropriate primary keys & foreign...
Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. Assumptions: 1. Each tool belongs to a category. 2. Each category may have a parent category but the parent category should not have a parent category (so at most two levels). E.g., a Tool A belongs to the electric mower, and electric mowers belong to mowers. Mower has no parent category. 3. Each tool can be rented at different time units. The typical...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT