Teaching Kids Programming – Most Common SQL keywords (Select, Update, Insert, Delete)


Teaching Kids Programming: Videos on Data Structures and Algorithms

Here are a few SQL keywords we learn this lessons. These are most common SQL syntax. SQL (Structured Query Language) is a de.facto “programming” language that is used to interact with the Database.

A Database contains table(s).

SELECT

“SELECT” is used to filter and retrieve data from database. We can return partial data by using the LIMIT (MySQL syntax) or TOP (SQL Server or Access) or FETCH FIRST (Oracle Syntax):

MS SQL Server / Access

select TOP 5 something
from some_table
where conditions

MYSQL:

select something
from some_table
where conditions
limit 5

Oracle:

select something
from some_table
where conditions
fetch first 5 rows only

Insert

We use the “Insert” keyword to add/append new records to tables. We can use the following three syntax:

insert into table (column1, column2 ...) 
values (value1, value2, ...)
insert into table
set column1 = value1, column2 = value2 ...
insert into table
set column1 = value1, column2 = value2 ...
insert into table (column1, column2 ...)
select column1, column2 ...
from table 
where conditions

Update

We use “Update” to change values (columns) of a table:

update table
set column1 = value1, column2 = value2
where conditions

Delete

We use the “Delete” to remove record(s) from a table and we can use where to specify the conditions:

1
2
Delete from Table
where conditions
Delete from Table
where conditions

The “delete from table” is the same as “truncate table” which we remove everything (content) from a table

Create Database

We can create database:

1
2
3
4
5
create database a_database (
  column1 type,
  column2 type,
  ...
);
create database a_database (
  column1 type,
  column2 type,
  ...
);

Learning SQL

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
445 words
Last Post: How to Read Parameters from a JSON File in BASH Script?
Next Post: Password Protect or IP Restriction on WordPress wp-admin Folder (htaccess and htpasswd)

The Permanent URL is: Teaching Kids Programming – Most Common SQL keywords (Select, Update, Insert, Delete)

Leave a Reply