Create database for car application, Database Management System

Assignment Help:

The Database

MySQL scripts cars_for_sale.sql and car_details.sql containing the data to use for this task have been supplied. To complete this task, you need to first create a database called inb104 and two tables called cars_for_sale and car_details. how to enter data into the two tables by using the supplied scripts. (Note that the supplied scripts are not database 'dumps', so you cannot just 'import' the whole database. You need to manually set up the database first and then run the scripts.) The two tables you must create in the inb104 database must contain the following fields. For the cars_for_sale table:

CarId    VARCHAR(45)

make     VARCHAR(45)

model    VARCHAR(45)

 For the car_details  table:

 CarId       VARCHAR(45)

seriesyear   VARCHAR(45)

price             INT(11)

kilometres   VARCHAR(45)

color              VARCHAR(100)

transmission  VARCHAR(45)

CarId is the Primary Key for both tables.

As usual we have supplied Python 'question' template files for you to complete, containing unit tests that your functions must pass. You should rename these files, removing the "_Q" suffixes, and complete your solutions in the places indicated.

Specific Tasks

The specific things you must do to complete this portfolio task are as follows.

1.  Create a database named inb104 containing  two tables called cars_for_sale and car_details, as explained above, to import the data into.

2.  Import the  vehicle  data  via the  cars_for_sale.sql and  car_details.sql scripts.

3.  Write  a Python function named  top_N_makes(N)  that  extract the  number of occurrences of each make in the car dataset and prints the top N most frequent makes together with their corresponding number of occurrences, one make per line.  Parameter N indicates the number of makes to be printed. 

For example, if BMW appears in 100 rows in the table cars_for_sale, its frequency will be 100.  If BMW and KIA are the top two most frequent makes, occurring 100 and 89 times,  respectively, your function is expected to produce the following result for the function call top_N_makes(2).

>>> top_N_makes(2) 

BMW 100

KIA 89

Note that if more results are requested than there are distinct makes in the database then all makes must be listed.  Also note that if two makes have the same frequency of occurrence then they should appear alphabetically.


Related Discussions:- Create database for car application

Explain domain-oriented relational calculus?, How does Tuple-oriented relat...

How does Tuple-oriented relational calculus vary from domain-oriented relational calculus? The tuple-oriented calculus uses a tuple variables i.e., variable whose only allowed

Two phase locking technique, growing phase and shrinking phase are disjoint...

growing phase and shrinking phase are disjoint, why ?

What is meant by normalization of data, What is meant by normalization of d...

What is meant by normalization of data? It is a process of examining the given relation schemas based on their Functional Dependencies (FDs) and primary key to achieve the prop

What is database trigger, What is database Trigger? A database trigger ...

What is database Trigger? A database trigger is a PL/SQL block that can explained to automatically execute for insert, update, and delete statements against a table. The trigge

Define the notation for classes and atrributes, Define the notation for cla...

Define the notation for classes and atrributes The notation for class, attribute, and operations are shown below:     Figure: Class with attributes and operations A

What is a name, What is a Name? A user-supplied name is used for identi...

What is a Name? A user-supplied name is used for identity. This form of identity is used for files in file systems. The user gives every file a name that uniquely identifies it

Define aggregate functions, Define Aggregate functions and what aggregate f...

Define Aggregate functions and what aggregate functions supported by the MySQL To calculate a summary value from a set of individual values and uses one of the functions known

Draw and explain the three level architecture of database, Draw and explain...

Draw and explain the three level architecture of the database system? A DBMS gives three levels of data is said to follow three-level architecture. The trget of the three-schem

State the object design for processing, State the Object Design for Process...

State the Object Design for Processing  The object design phase comes after analysis and system design phase. The object design phase includes implementation details like as i

What are the advantages of logical databases, What are the advantages of Lo...

What are the advantages of Logical Databases? It offers a simple-to-use selection screens.  You can change the pre-generated selection screen to your needs.  It offers check f

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd