| |

Teradata Viewpoint – SQL Scratchpad – Writing Queries Dillard’s Department Store Database

Teradata viewpoint

Analysing ‘Big Data’ from a database with real world data requires retrieving data from the database by writing relevant queries. As part of “Managing Big Data with MySQL” by Duke University on Cousera, I dealt with real world data that comprise hundreds to millions of entries/rows.

This is the database of Dillard’s Department stores, specifically, the

UA_DILLARDS that contains sales transaction data for 453 Dillard’s Department stores between August 2004 and July 2005.

The full actual and details of the tables in the database can be found on the University of Arkansas website

(Note: there was an additional table provided in the course which gave more data to the SKSTINFO  and that table is the SKSTINFO_FIX. Hence there are 7 tables that will be looked at here.  )

for reference, the full list of tables from the Dillard’s dataset are

  • DEPTINFO
  • SKSTINFO
  • SKSTINFO_FIX
  • SKUINFO
  • STORE_MSA
  • STRINFO
  • TRNSACT

The SQL queries here were written as part of assignments in Coursera course. These are my personal codes and criticisms and additions are welcome

Exercise 1. Use HELP and SHOW to confirm that the relational schema provided to us for the Dillard’s dataset shows the correct column names and primary keys for each table.

 

Exercise 2. Look at examples of data from each of the tables. Pay particular attention to the skuinfo table.

 

Exercise 3. Examine lists of distinct values in each of the tables.

 

Exercise 4. Examine instances of transaction table where “amt” is different than “sprice”. What did you learn about how the values in “amt”, “quantity”, and “sprice” relate to one another?

When the “amt” is different than “sprice” then the quantity purchased was more than 1

Exercise 5: Even though the Dillard’s dataset had primary keys declared and there were not many NULL values, there are still many strange entries that likely reflect entry errors. To see some examples of these likely errors, examine: (a) rows in the trsnact table that have “0” in their orgprice column (how could the original price be 0?), (b) rows in the skstinfo table where both the cost and retail price are listed as 0.00, and (c) rows in the skstinfo table where the cost is greater than the retail price (although occasionally retailers will sell an item at a loss for strategic reasons, it is very unlikely that a manufacturer would provide a suggested retail price that is lower than the cost of the item).


Exercise 6. Write your own queries that retrieve multiple columns in a precise order from a table, and that restrict the rows retrieved from those columns using “BETWEEN”, “IN”, and references to text strings.

– retrieve multiple columns in a precise order from a table

– select distinct rows from a table – rename columns in a query output

– restrict the data you retrieve to meet certain criteria – sort your output – reference parts of text “strings”

– use “BETWEEN” and “IN” in your query statements

Want more information like this?

Similar Posts

  • |

    Creating Oracle PL/SQL Tables for Intercollegiate Athletic Database – Data Warehousing

    Creating Oracle  tables for Intercollegiate Athletic Database. Part of Assignment one of Data Warehousing for Business Intelligence on Coursera

    After creating the tables lets insert values

      In case you want to change a constraint on a field, you can use a syntax examples as the following. ALTER TABLE FACILITY ADD CONSTRAINT UNQ_FAC UNIQUE (FACNAME)…

  • |

    Rank a Place Visited By a Customer- Microsoft SQL Server – T-Transact

    This is a short guide to getting ranking or rating from Microsoft Sql Server customers. Ranking is taken by checking how many times a customer has visited a particular country divided by the total number of travels the customer has made within the database  

        Want more information like this?

  • |

    Making Data Management Decisions – Data Analysis and Intrepretation

    Making Data Management Decisions   Background of the Dataset CSV file Used: The background to the Dataset CSV file used has been explained extensively in the week 2’s assignment. Not to bore assessors and readers by repeating everything here again, please simply check the background information from my previous assignment which can be assessed at this link: http://adabadata.tumblr.com/…

  • | |

    Using Subqueries To Join 2 More Tables Which Do Not Have Unique Primary and Foreign Keys

    Using Subqueries to join 2 more tables which do not have distinct values in a column We want to find the number of Flight bookings by Country, number of Car bookings by Country and the number of Hotel bookings by Country all appearing in one table with same country on one row. We want to…

  • |

    Test a Multiple – Multivariate Regression Model

    OVERVIEW My research work deals with Ghana, a country from the Gapminder dataset.   What I found in my multiple regression analysis. Discussion of the results for the associations between all of my explanatory variables and my response variable The primary quantitative explanatory variable in my regression analysis is the Income Per Person (incomeperperson) and…

  • |

    Choosing a Dataset – Data Management and Visualization

    I have gone through all the codebooks and having finished going through all of them I am particularly interested in the GapMinder dataset. From the GapMinder dataset my focus will be on the Life expectancy of a particular country. I have chosen to focus on the country, Ghana. The Life Expectancy of the people of…

One Comment

  1. Wow, amazing weblog structure! How lengthy have you ever been blogging for?
    you make blogging look easy. The overall glance
    of your site is fantastic, let alone the content!

Leave a Reply

Your email address will not be published. Required fields are marked *