ADS

Featured

Examples of SQL commands

The entire system uses a database, and you sometimes need advanced programming skills to be able to create them.

In this tutorial you will follow some tips on how you can improve your knowledge and learn more about SQL (Structured Query Language) codes.


If you are looking for somewhere the basics of sql functions (you came from google), see now below:

Create a table:
Access: "create table suatabela (id int PRIMARY KEY NOT NULL autoincrement, varchar observations [255] NULL)"
MySQL: "create table suatabela (id int PRIMARY KEY NOT NULL auto_increment, varchar observations (255));"
SQL Server: "create table [suatabela] (id int PRIMARY KEY NOT NULL IDENTITY [1,1], varchar observations [255] NULL)"

Make an appointment:
All: "Select * from suatabela"
MySQL: "Select * from suatabela;" <- MySQL needs a semicolon at the end.

Another examples:
"select * from your table like observations = 's%'" <- displays results starting with the letter "s".
"select * from your table like observations = 'hate'" <- displays results with the word hate in the middle of the observation text.

Make an inclusion:
"insert into your table (observations) values ​​('value1')"
MySQL: "insert into ´suatabela´ (´observacoes´) values ​​(´valor1´);" <- MySQL can use both quotation marks and an acute accent. It is safer to use an acute accent since it does not belong to the basic characters of the ASCII table, that is, if a user types a quotation mark in a form field, it will actually come as quotation marks, and not as something that will break your string.

Perform a deletion:
"delete from your table where id = 20"

Update a record:
"update suatabela set observacao = 'This observation has been changed.' where id = 20 "
"update suatabela set observacao = 'Another change', id = 0 where id = 60"

No comments