Computer Science Homework Solutions

SQL Database

Use SQL Management Studio to create a database called ITD410_P1.MDF. Be sure to store the database in a location you will remember. Add the tables and data shown below to the database. Use appropriate field types and lengths. Be sure to detach your database and create a zip file called ITD410_P1.ZIP with your database and the ...continues

PQ #1

I have a query that starts with the line: SELECT books.isbn, order_lines.isbn ...why would I want to see isbns from two different tables? What sort of query would warrant that - an inner join or an outer join? Assume the table "books" contains books that the company stocks. Assume the table order_lines only ...continues

Running a Query

Why wont this query run and how would you write it correctly? Major hint: try and run the query (use the database attached to Week 2's lecture) ... you'll get an error message that should explain: SELECT isbn FROM books INNER JOIN order_lines ON books.isbn = order_lines.isbn;

Query Results

Why wont this query give any results (using the week 2 lecture database)? SELECT orders.order_numb, customers.customer_last_name FROM customers INNER JOIN orders ON customers.customer_numb = customers.customer_last_name;

Query Results

How come I get so many Smiths in this query (using the Week 2 lecture database)? There's only 26 orders and 4 customers named Smith. Yet I get 104 rows as a result? SELECT orders.order_numb, customers.customer_last_name FROM orders, customers WHERE customers.customer_last_name like "smith";

Rows from a Query

You can create your own Cartesian product - run this code in the database attached to Lecture Two: SELECT books.author_name, authors.author_name FROM books, authors; How many rows do you get as a result?

Query Results - RIGHT Outer Join

Using the week 2 lecture database, if you wanted to see all the isbns from the books table and any matching isbns from the order_lines table, you'd want to do an outer join as such (because not every book stocked has been ordered): SELECT books.isbn, order_lines.isbn FROM books LEFT JOIN order_lines ON books.isbn = order_li ...continues

Open Source Database

Read these two web articles and answer these questions: http://www.opensource.org/docs/definition.php http://searchenterpriselinux.techtarget.com/originalContent/0,289142,sid39_gci1069685,00.html * What is an open source database? * Why would a company want to use an open sourced database?

SQL Server database for Kudler Fine Foods/Service Request SR-kf-009

Create the following two tables using the following fields: Note: Supply the appropriate SQL Server data types when creating the tables. In the Employee table, create an Employee ID field that will generate a unique number for each employee and designate the field as the Primary Key. In the Job Title table, you will need to ...continues

Database Coding

1. Using the order_lines table from the database from lecture 2, write the SQL that will give the Min and Max values of the column "cost_each" 2. Using the week 2 homework database, show each customer number and count the instances of each customer_numb in the table orders. Hint: follow this pattern (where the words TAB ...continues

Browse