sql-database

[!WARNING] This section is under development

Exercises Week 2

Exercise 1: Company[1]

You are tasked with designing the conceptual model of a database to map a company’s structure.

Here is what you know:

Exercise: design an ER diagram to represent the company’s structure.

Some tips:

Exercise 2: Gardener

You are now tasked with designing a database to help out a local gardener.

John is a gardener who’s in charge of the maintenance his clients’ gardens. Thus, he wants to know about each client: their name, tax number, address and location.

For each garden it is necessary to know: the name, address, location, area (in hectares), the customer responsible for this garden and whether they own the garden or are just exploring it. A customer can have multiple gardens.

Still for each garden is necessary to know the types of plants that are found there, the area occupied by each of these plant types, and number of plants of each type. About the types of plant, it’s important to know its common name (for example: orange blossom) and its scientific name (e.g., citrus sinensis).

For each type of plant it still matters to know the pests that affect it (for example, the orange trees can have cochineal). For each pest, it’s important to know whether or not a treatment exists.

Exercise: design an ER diagram to represent needs of John. Remember the tips from Exercise 1.

Exercise 3: Formula 1

You are now tasked with creating a database for a simplified version of a Formula 1 season.

This time, the conceptual model is already complete.

Exercise: create a database for Formula 1 by following the diagram and writing a set of CREATE TABLE statements in a s1.sql file.

alt text

Exercise 4: LinkedIn[2]

Now, you’ll create a database from scratch.

Create a database representing LinkedIn from scratch, as by writing a set of CREATE TABLE statements in a linkedin.sql file. The implementation details are up to you, though you should minimally ensure that your database meets the platform’s specification and that it can represent the given sample data.

Users

The heart of LinkedIn’s platform is its people. Your database should be able to represent the following information about LinkedIn’s users:

Schools and Universities

LinkedIn also allows for official school or university accounts, such as that for HackYourFuture Belgium, so alumni (i.e., those who’ve attended) can identify their affiliation. Ensure that LinkedIn’s database can store the following information about each school:

Companies

LinkedIn allows companies to create their own pages, like the one for HackYourFuture Belgium, so employees can identify their past or current employment with the company. Ensure that LinkedIn’s database can store the following information for each company:

Connections

And finally, the essence of LinkedIn is its ability to facilitate connections between people. Ensure LinkedIn’s database can support each of the following connections.

Connections with People:

Connections with Companies:

Your database should be able to represent…

Submitting your work

Once you’ve completed the exercises, please share them with your Coach:

References