Skip to content

Instantly share code, notes, and snippets.

View rodriguezd's full-sized avatar

David Rodriguez rodriguezd

View GitHub Profile
1. Grab the jar that says "JELLY" on it.
2. Twist off the top of the jelly jar and place the top on the table.
3. Place the jelly jar back on the table.
4. Grab the jar that says "PB" on it.
5. Twist off the top of the PB jar and place the top on the table.
6. Place the PB jar back on the table.
7. Grab the bag that says "BREAD".
8. Open the bread bag.
9. There are many slices in the bag, pull one slice out of the bag.
10. Place the bread bag back on the table.
David Rodriguez
Github Username: rodriguezd
Blog Url: rodriguezd.github.io
Tagline: "Great coders do not choose their destiny, destiny chooses them."
Profile Picture (something normal, a headshot, of a good reusable size that can be easily cropped)
country_capitals
(6, 'Capital of the United States?", 2)
(7, 'Capital of Japan?", 2)
(8, 'Capital of Russia?", 2)
(9, 'Capital of England?", 2)
(10, 'Capital of Germany?", 2)
SELECT COUNT(*)
FROM answer, choice, question
WHERE(
answer.user_id = 1 AND
question.quiz_id = 1 AND
question.question_id = answer.question_id AND
choice.question_id = answer.question_id AND
choice.choice_id = answer.choice_id AND
choice.choice_correctness = 1
);
3) Which DVD is the most expensive?
SELECT title FROM dvd WHERE price = (SELECT MAX(price) FROM dvd);
4) What is the total cost of any two DVD's (your choice which two)
SELECT SUM(price) FROM dvd WHERE id IN (1, 2);
5) Return just the titles for all the DVD's in the database.
1) Select the price of a flight
SELECT price FROM flight WHERE id = 3;
2) Select the departing and arriving time of a flight
SELECT departure_time, arrival_time FROM flight WHERE id = 3;
3) Select all flights that have only one stop.
1) What are all the apartment listings?
2) What are the listings for an entire home?
3) What are the listings for apartments in Hoboken?
4) What are the listings for homes in New York City at most 3 people?
5) What are the listings belonging to user1?
1) What are all the apartment listings?
1|apt|entire|2|New York City|1
2|apt|shared|1|New York City|2
3|apt|entire|1|Hoboken|2
4|apt|private|2|Jersey City|3
5|apt|entire|2|Hoboken|2
6|apt|private|2|New York City|1
2) What are the listings for an entire home?
@rodriguezd
rodriguezd / Ruby: Roman to Arabic
Last active December 18, 2015 07:08
Ruby program that converts roman numerals into their corresponding arabic numeral value. Roman numerals must be entered in valid format.
CAVEAT: I spent ZERO time refactoring this code so I'm quite sure it is not the ideal solution.
roman_num = ""
while roman_num != 'END'
print "Enter a roman numeral ('end' to quit): "
roman_num = gets.chomp.upcase
arabic_num = 0
last_char_value = 0
roman_char_array = [];
@rodriguezd
rodriguezd / Ruby: Arabic to Roman
Last active December 18, 2015 07:19
Ruby program that converts arabic numbers into their corresponding roman numeral value. Arabic value entered must be a whole number and 3999 or less.
CAVEAT: Arabic number entered must be a whole number and 3999 or less.
arabic_num = 0
while arabic_num != 'END'
print "Enter an arabic whole number ('end' to quit): "
input = gets.chomp.upcase
unless input == 'END'
arabic_num = input.to_i
roman_numeral = []