Quotes help make search much faster. Example: "Practice Makes Perfect"
Wednesday, September 4, 2013
SQL Problem: Select all columns for everyone whose last name ends in "ith".
Solution:
SELECT * FROM employee WHERE last LIKE '%ith';
SQL Problem: Select all columns for everyone over 80 years old.
Solution:
SELECT * FROM employee WHERE age > 80;
SQL Problem: Select the first name for everyone whose first name equals "Potsy".
Solution:
SELECT first FROM employee WHERE first = 'Potsy';
SQL Problem: Select all columns for everyone whose last name contains "ebe".
Solution:
SELECT * FROM employee WHERE last LIKE '%ebe%';
SQL Problem: Select first name, last name, and salary for anyone with "Programmer" in their title.
Solution:
SELECT first, last, salary FROM employee WHERE title = 'Programmer';
SQL Problem: Select first and last names for everyone that's under 30 years old.
Solution:
SELECT first, last FROM employee WHERE age < 30;
SQL Problem: Select all columns for everyone with a salary over 30000.
Solution:
SELECT * FROM employee WHERE salary > 30000;
SQL Problem: Select all columns for everyone in your employee table.
Solution:
SELECT * FROM employee;
SQL Insert Problem
Problem:
Enter these employees into your table
Jonie Weber, Secretary, 28, 19500.00
Potsy Weber, Programmer, 32, 45300.00
Dirk Smith, Programmer II, 45, 75020.00
Solution:
insert into employee
(first, last, title, age, salary)
values ('Jonie', 'Weber', 'Secretary', 28, 19500.00);
insert into employee
(first, last, title, age, salary)
values ('Potsy', 'Weber', 'Programmer', 32, 45300.00);
insert into employee
(first, last, title, age, salary)
values ('Dirk', 'Smith', 'Programmer II', 45, 75020.00);
SQL Create Table Problem
Problem:
Create a table that will contain the following information about your new employees: firstname, lastname, title, age, and salary.
Solution:
create table employee
(first varchar(20),
last varchar(20),
title varchar(20),
age number(3),
salary number(10));
SQL Problem: Display all columns for everyone whose first name contains "Mary".
Solution:
SELECT * FROM table_name WHERE first_name LIKE '%Mary%';
SQL Problem: Display all columns for everyone whose first name equals "Mary".
Solution:
SELECT * FROM table_name WHERE first = 'Mary';
SQL Problem: Display the first and last names for everyone whose last name ends in an "ay".
Solution:
SELECT first, last FROM table_name WHERE last LIKE '%ay';
SQL Problem: Display all columns for everyone that is over 40 years old.
Solution:
SELECT * FROM table_name WHERE age > 40;
SQL Problem: Display the first name, last name, and city for everyone that's not from New York.
Solution:
SELECT first_name, last_name, city FROM table_name WHERE city <> 'New York';
SQL Problem: Display the first name and age for everyone that's in the table
Solution:
SELECT first_name, age, FROM table_name;
Subscribe to:
Comments (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
#sample solution pyg = 'ay' original = raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): p...
-
A typical compounding problem would be something like: How much is the equivalent Present Value (P) if an investment pays an amount (A...
-
A typical compounding problem would be something like: How much will I get annually (A) starting next year if I invest a present value...
-
<style> p { font-family: sans-serif; font-size:18px;} div#welcome p{ font-family: cursive; font-size: 24px; color: white; b...
-
A typical compounding problem would be something like: What is the present value (P) of a future value (F) if (P) was deposited/lent a...
-
// Sample solution // Write a string rotation method. // It should pass all the tests given below. String.prototype.rotate = function(n...
-
A typical compounding problem would be something like: What is the future value (F) of a present value (P) deposited/lent at an intere...
-
<style> #content p {color: yellow;} p {color: purple;} p {color: green;} </style> <div id="content...
-
#sample solution class Triangle(object): #member variables number_of_sides = 3 #methods def __init__(self, angle1, angle2, angle...
-
#sample solution class Shape(object): """Makes shapes!""" def __init__(self, number_of_sides): self....