subscribe: Posts | Comments

Syntax and examples for entering records into a table


Records can be entered from sentences using the INSERT statement.

The syntax used is:

Insert Into tbl_name (nombre_campo1, nombre_campo2 ,…) Values (valor_campo1,
valor_campo2 …)

A simple example from our table model is the introduction of a new client which
would be an investigation of this type:

Insert into customers (name, address, town, Zip Code, email, ordering) VALUES (
‘Perico’, ‘tallies’,’ Percebe No 13 ‘,’ Lepe ‘,’123456′, ‘’
, 33)

As can be seen, or non-numeric fields are delimited by backticks boolean ‘. It
is also interesting to see that the zip code we have not saved as a numeric
field. This is because in certain countries (England, not) zip codes also
contain letters.

Of course, it is imperative to fill in all the fields in the record. But it may be that certain fields are required. These fields can be defined when we build our table through the database.

It is very interesting, as we shall see later why, introduced during the creation of a field AutoIncrement our table to allow us to assign a unique number to each record. Thus, our present customers table for each record a unique number which the customer will be very useful to consult when several tables simultaneously.

FOR can make a friend as the ASP in this way:

Country dim (3) ‘this is an array with 4 locations
dim id (3)
Country (0) = "Argentina"
Country (1) = "Peru"
Country (2) = "Uruguay"
Country (3) = "Bolivia"
id (0) = 1
id (1) = 2
id (2) = 48
id (3) = 5
for i = 0 to i = 3
INSERT INTO TPAIS (ID, COUNTRY) VALUES (id (i), country (i))