Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
150 views

SQL Practice: Introduction To Structured Query Language (SQL)

The document discusses using SQL to create an employee table with columns for first name, last name, title, age, and salary. It then shows examples of inserting data for three employees into the table, selecting rows where the last name ends in "ith", updating an employee's last name, and selecting rows where the salary is between 40000 and 80000.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views

SQL Practice: Introduction To Structured Query Language (SQL)

The document discusses using SQL to create an employee table with columns for first name, last name, title, age, and salary. It then shows examples of inserting data for three employees into the table, selecting rows where the last name ends in "ith", updating an employee's last name, and selecting rows where the salary is between 40000 and 80000.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SQL practice

Introduction to Structured Query Language (SQL)

Create
You have just started a new company. It is time to hire some employees. You will need to create a table that will contain the following information about your new employees: first name, last name, title, age, and salary .

01.12.2010

Sarajevo School of Science and Technology

Create
create table EMPLOYEE ( first varchar(15), last varchar(20), title varchar (30) age number(3), salary number (5) );
01.12.2010 Sarajevo School of Science and Technology 3

Insert
It is time to insert data into your new employee table. Your first three employees are the following:
Jonie Weber, Secretary, 28, 19500 Potsy Weber, Programmer, 32, 45300 Dirk Smith, Programmer II, 45, 75020

01.12.2010

Sarajevo School of Science and Technology

Insert
insert into EMPLOYEES (first, last, title, age, salary) values ('Jonie', 'Weber', 'Secretary', 28, 19500);

01.12.2010

Sarajevo School of Science and Technology

Select
Select all columns for everyone whose last name ends in "ith".

01.12.2010

Sarajevo School of Science and Technology

Select
Select * from Employees where last LIKE %ith

01.12.2010

Sarajevo School of Science and Technology

Update
Jonie Weber just got married to Bob Williams. She has requested that her last name be updated to WeberWilliams.

01.12.2010

Sarajevo School of Science and Technology

Update
Update Employee set last=Weber-Williams where first=Jonie and last=Weber

01.12.2010

Sarajevo School of Science and Technology

Select
Select the first name, last name, salary from the employee table for all of the rows that have a salary value ranging from 40000 to 80000.

01.12.2010

Sarajevo School of Science and Technology

10

Select
Select first, last, salary from Employee where salary between 40000 and 80000

01.12.2010

Sarajevo School of Science and Technology

11

You might also like