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

Write short note on events, Write short note on Events Events consist ...

Write short note on Events Events consist of inputs, interrupts, decisions and actions performed by any external device or users. Every event always has a sender and receiver.

Which operator is cartesian product in relational algebra, Which operator i...

Which operator is Cartesian product in relational algebra? Cartesian product in relational algebra is a binary operator. (It requires two operands. e.g., P X Q)

Explain a data dictionary, What is a data dictionary? Data Dictionary ...

What is a data dictionary? Data Dictionary is a main source of data in a data management system.  Its major function is to carry the creation and management of data definition

What is icr, What is ICR? A. ICR (Intelligent Character Recognition) is...

What is ICR? A. ICR (Intelligent Character Recognition) is a technology that gives scanning and imaging systems the ability to identify images of hand-printed or script charact

What are the states of transaction, What are the states of transaction? ...

What are the states of transaction? The states of transaction are:- a) Active b) Partially committed c) Failed d) Aborted e )Committed   f) Terminated

What is known as heap file organization, What is known as heap file organiz...

What is known as heap file organization? In the heap file organization, any record can be placed anywhere in the file where there is space for the record. There is no ordering

Determine set of minimal functional dependency-normalization, 1. Determine ...

1. Determine the set of minimal functional dependencies for the following data. The local bakery, Happy Cakes, needs your help designing a database that will support a kiosk in

Related fields in a database are grouped in which form, Related fields in a...

Related fields in a database are grouped in which form? Related data fields in a database are grouped to form a data record. (A record is a collection of related fields)

Define the wait for graph, Define the Wait for graph Ans: The wait-for-...

Define the Wait for graph Ans: The wait-for-graph is a directed graph and consist of nodes and directed arcs; the nodes of the graph are active transactions. An arc of the grap

Idea for fyp, want a idea for final year project

want a idea for final year project

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