top of page

Database Design Help Using PostgreSQL | Design Smith and Co Second-Hand Bookshop Database

Task 1: Smith and Co Second-Hand Bookshop

Scenario: The Smith and Co second-hand bookshop wishes to maintain data on their customers, authors and books. They may have many books by each author in the bookshop at one time. Books may be bought and sold several times. In other words, as the bookshop is a second-hand store they may sell a book, then buy it back off the customer at a later date to sell on to another customer. A sample customer history form can be seen below.


Using normalisation, produce a set of entities thinking carefully about appropriate use of entity and attribute names.

Normalisation Table: produce a normalisation table up to Third Normal Form (3NF) of the proposed system. The normalisation table should include the entities, attributes, primary and foreign keys. Use the example in Appendix 2 as a template for your normalisation table.

Short Report: Write a report (of approximately 500 words) on any two potential database attacks which could occur on the Smith and Co Second-Hand bookshop database. For each attack:

  • Include information relating to why the database might be a target for an attack,

  • the type of attacks which may occur; and,

  • the type of data that might be extracted from the system in each attack. Remember to cite any resources using Harvard referencing.

Task 2: St. John’s Hospital

Produce an E-R diagram and data dictionary for the following scenario. Ensure you think carefully about entity names and attribute names and data types.



St John’s hospital are updating their filing systems and want to move their medical records within their hospital pharmacy to a computerised system to enable ease of use for staff and to modernise their old paper-based filing system. You have been tasked with developing a database application to meet their needs.

Current Position

Currently, St John’s pharmacy record details of all patients (including their name, address, date of birth, ID number, telephone number). They also store the prescription details for each particular patient (including the prescription number, the date prescribed, the name of the doctor who prescribed it, the name of the pharmacist who dispensed it and the issue date). The pharmacy also need to keep a record of their stock levels of drugs so that they can order more in when stock becomes too low, this includes keeping a record of each drug, its name and item cost as well as the specific details of when this drug is prescribed and dispensed including the quantity prescribed and issued.

Entity-Relationship Diagram:

Using an Entity-Relationship (E-R) diagram, produce a design of the proposed system, correctly showing labelled relationships with cardinality constraints clearly indicated, using the notation taught in the module. You do not need to show attributes on the diagram, only entity names. Ensure that you state clearly any assumptions that you have made in creating your Entity-Relationship Diagram.

Data Dictionary: Using a data dictionary, specify a set of tables and appropriate attributes for your design from the Entity-Relationship diagram above. For each table, your data dictionary must specify:

  • Table name;

  • For each attribute, its name, description and data type (using PostgreSQL data types used in the SQL booklet for this module);

  • Primary key and any foreign keys (ensure you specify which table each foreign key relates to);

  • any further constraints on the data (e.g. business constraints on data values and dates; required format; and whether the attribute is null/not null).

Contact us at below mail id to get solution of above problem or any other Project related postgresql:


bottom of page