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:
Posts (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
//Sample Solution const gameState = {} function preload() { this.load.image('codey', 'https://s3.amazonaws.com/codecademy-...
-
Answer: From 1 to 9 days
-
Say you had an election, and you needed to tally the votes for each candidate. All you need to do is enter the name of each candidate o...
-
//sample solution to MainController.js app.controller('MainController', ['$scope', function($scope) { $scope.title = ...
-
class Dog{ int age; public Dog(){ } public static void main(String[] args) { } }
-
//Sample solution to main.js var red = [0, 100, 63]; var orange = [40, 100, 60]; var green = [75, 100, 40]; var blue = [196, 77, 55]; ...
-
$(document).ready(function(){ $("button").on("click", function(){ var message = $("<span>Call 1-555-...
-
$VERBOSE = nil # We'll explain this at the end of the lesson. require 'prime' # This is a module. We'll cover these s...
-
function isSolved(sudoku) { // A sudoku will be solved if all its rows, columns and blocks are correct. // Use a combination of t...
-
<!--sample solution--> <h1>All about Sean!</h1> I like a lot of things, like butterflies, deer eyelashes, and especia...