Here's a query:
SELECT orders.order_date, orders.customer_numb
FROM orders INNER JOIN order_lines ON orders.order_numb = order_lines.order_numb
WHERE order_lines.isbn = '0-131-4966-9';
and here it is rewritten using a subquery:
SELECT order_date, customer_numb
Write SELECT statements for the following questions. Make sure to include the statement execution, including the resulting data.
Display all columns and all rows from the Employees table.
9 rows returned
Display the regionid, regiondescription for all rows in the Regions table.
4 rows returned
Modify query 2 so that the
The schema of the DB is as follows:
Department(DeptNum, Descrip, Instname, DeptName, State, Postcode)
Academic(AcNum, *DeptNum, FamName, GiveName, Initials, Title)
Field(FieldNum, ID, Title)
Interest(*FieldNum, *AcNum, Descrip)
Which fields have interests share
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";
The purpose of the attach php code searches a MYSQL database and then return the results to the screen.
It works very well, just that it displays all the search results all in one screenful. If it found 100 records then that's how many records it displays to the screen at a time.
Need help making it display 10 records at
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?
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
Please Complete in Script.
Write SQL statements that will retrieve the following data from a database, using Subqueries and Joins. Using the Northwind database, write a SQL SELECT statement that will retrieve the data for the following questions:
1. For each order, display the Company Name, City, and the Country for the