diff --git a/sql.txt b/sql.txt index 5351a54..1a51479 100644 --- a/sql.txt +++ b/sql.txt @@ -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; diff --git a/years_to_hours.rb b/years_to_hours.rb new file mode 100644 index 0000000..cc3423d --- /dev/null +++ b/years_to_hours.rb @@ -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." \ No newline at end of file