Basic SQL commands

in #my4 years ago

download.png

What is SQL?
SQL stands for Structured Query Language. SQL lets you access and manipulate databases.

Database Tables
A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data.

In this tutorial we will use the a dummy table.
Below is a selection from the "Customers" table:

CustomerID CustomerName ContactName
1 Jelly jelly-cute
2 Potpot pot
3 Barbie bee

The table above contains 3 records (one for each customer) and 3 columns (CustomerID, CustomerName, ContactName).

SQL Statements

Most of the actions you need to perform on a database are done with SQL statements.

The following SQL statement selects all the records in the "Customers" table:
SELECT * FROM Customers;

note: SQL keywords are NOT case sensitive: select is the same as SELECT

Some of The Most Important SQL Commands
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 58647.98
ETH 2291.48
USDT 1.00
SBD 2.46