Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sql.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ SELECT with JOIN practice:
Join the OrderDetails and Products tables, to show a report where the columns are OrderID, ProductName, and Quantity.
Paste the SQL statement you used below.

SELECT od.OrderID, p.ProductName, od.Quantity FROM OrderDetails AS od INNER JOIN Products AS p ON od.ProductID = p.ProductID;

Join the Orders, OrderDetails, and Employees tables to return a report with with the EmployeeName, ProductID, and Quantity.
Paste the SQL statement you used below. Hint: EmployeeName is not a column in the Employee table, but you can generate a
report with EmployeeName by starting your SQL this way: SELECT (Employees.FirstName || " " || Employees.LastName) AS EmployeeName,

SELECT (e.FirstName || " " || e.LastName) AS EmployeeName, od.ProductID, od.Quantity FROM Orders AS o
INNER JOIN OrderDetails AS od ON o.OrderID = od.OrderID
INNER JOIN Employees AS e ON o.EmployeeID = e.EmployeeID
ORDER BY EmployeeName;

17 changes: 17 additions & 0 deletions years_to_hours.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
puts "Enter a number of years"
years = gets.chomp # this returns a string
years = years.to_i # this converts a string to an integer
hours = years * 365 * 24
puts "That's #{hours} hours."

puts "Enter a number of decades"
decades = gets.chomp # this returns a string
decades = decades.to_i # this converts a string to an integer
minutes = decades * 10 * 365 * 24 * 60
puts "That's #{minutes} minutes."

puts "Enter your age"
age = gets.chomp # this returns a string
age = decades.to_i # this converts a string to an integer
seconds = age * 365 * 24 * 60 * 60
puts "That's #{seconds} seconds."