In this article I will explain about basic SQL queries. I will show the most used, to select the necessary information, to edit data, delete and order detailed information.
CREATE
This command creates an object within the database manager. It can be a database, table, index, stored procedure or view.
CREATE syntax (create table example)
CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
….
)
SELECT
Displays information about the data stored in the database. Such information may belong to one or more tables.
SELECT basic syntax
SELECT column_name1, column_name2
FROM table_name;
WHERE
Specifies a condition that must be met for data to be returned by the query. It supports the logical operators AND and OR.
WHERE basic syntax
SELECT column_name1, column_name2
FROM table_name
WHERE column_name operator value
INSERT
Add one or more records to one (and only one) table in a relational database.
INSERT basic syntax
INSERT INTO table_name
(column_name1, column_name2, ….)
VALUES
(value1, value2, ….)
UPDATE
The UPDATE statement is used to update existing records in a table.
UPDATE basic syntax
UPDATE table_name
SET column1=value1,column2=value2,…
WHERE some_column=some_value
DELETE
The DELETE statement is used to delete records in a table.
DELETE basic syntax
DELETE FROM table_name
WHERE some_column=some_value
And that’s it! Using these basic commands help you manage your databases. These are basic SQL queries you should know how they work.
This concludes Running Basic SQL Queries
Looking for quality Windows Hosting? Look no further than Arvixe Web Hosting!
Happy Hosting!