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 def colorful_conditions(): color = "blue" if color == "red": return "firs...
-
//Sample Solution const gameState = {} function preload() { this.load.image('codey', 'https://s3.amazonaws.com/codecademy-...
-
function checkAnswerWrongPlace(ans, realanswer){ // This method compares two input strings representing a player's guess ("an...
-
//sample solution //Here is the original card object var card1 = {"suit":"clubs", "rank": 8}; //Create a ...
-
function sumAll(arr) { var sorted = arr.sort(function(a, b){return a-b}); var sum = 0; for(var i=sorted[0]; i<=sorted[1]; i++){ ...
-
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <!-- Echo your...
-
// sample solution to script.js $(document).ready(function() { $("ul.tabs li").click(function(){ var pageID = $(t...
-
// Sample Solution using System; namespace StoryTime { class Program { static void Main(string[] args) { // Decla...
-
Problem: The task is to minimize the value of the fraction x/f(x) where x is any 3-digit number and f(x) is its digits sum. What is the 3-d...