Giter Site home page Giter Site logo

csci-3308-hw3's Introduction

Assignment 3—SQL

###Objectives

  • Write SQL statements.

###Database setup

  • Go to the directory where you downloaded the HW3-populate.sql file.
  • Log in to mysql
  • Create the database and run the download SQL script.
show databases;
create database HW3;
show databases;
use HW3;
show tables;
source HW3-populate.sql;
show tables;

Questions

Create a text file named Firstname_Lastname_HW3.sql with your SQL statement answers for the following as a working .sql file.

Test your script with source Firstname_Lastname_HW3.sql.

1) List all state names and their two-letter codes.
2) Write a query to report the information for all counties whose names start with “Prince”. (Hint: Use like). Output columns:
	 - name
	 - statecode
	 - populate_1950
	 - population_2010
	 - Order by state code.

3) Write a single query to list only the population in year 2010 for the state represented by Sen. Richard Lugar. Output column: populate_2010
4) Write a single query to report only the total number of the counties in ‘Maryland’. The query should not hard-code the state code for Maryland (join the two tables in the WHERE clause)
5)Write a single query to find the name of the state that was admitted last into the union.
6) Find all democratic (i.e., with affiliation = ‘D’) senators that are not chairman of any committee or sub-committee. Output columns: name Order by name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.