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;

This is an example of scrolling text using Javascript.

Popular Posts