" /> Password <br /><input type="password" name="passwd" id="passwd" class="inputbox" size="18" alt="password" />
Home Introduction to SQL
PDF

INSERT INTO

SQL INSERT INTO Syntax

1
INSERT INTO ([, ... ]) VALUES (,...)

1
INSERT INTO VALUES (,...)

insert

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger

Using the following SQL query:

1
2
INSERT INTO Persons
VALUES (4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger

"P_Id", "LastName" и "FirstName":

1
2
INSERT INTO Persons (P_Id, LastName, FirstName)
VALUES (5, 'Tjessem', 'Jakob')

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob


Comments

 
+60 #1 Den_IS 2009-12-02 17:04 Quote
 
 
0 #2 gen 2010-05-19 11:41 Thank you very much Quote
 
 
+2 #3 TeaMoor 2010-05-25 16:09 And if the table you want to add multiple rows, you need every time the command INSERT INTO enter? Neto is a way to write this command once, and then list the values ​​of each line required for bowl? Quote
 
 
+9 #4 аноним 2010-06-03 11:40
INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (NULL, 'Tjessem', 'Jakob'),(NULL, 'Tjessem 1', 'Jakob 1');
Quote
 
 
-11 #5 JC8 2010-06-09 08:03 And if I need to add value only in the 2nd and 4th columns? And the input data are entered formy.Kak do this? Quote
 
 
-7 #6 Юрий Мельник 2010-08-31 16:30 All the good times of the day

and if you need to make a form and input into the table to produce a text box on the form. as zaprogramirovat L button to perform this task
Quote
 
 
-4 #7 Irina 2010-10-27 15:13 Yes, join OS8 how to insert such a one ... or in the first and fourth column? Quote
 
 
+2 #8 Azat 2010-11-12 23:13 JC8 can logically assume that simply typing the name in the INTO right column
INTO Persons (P_Id, LastName, FirstName) can be

INTO Persons (P_Id, FirstName)
Quote
 
 
+9 #9 LongMan 2010-11-18 12:14 Please tell me how to avoid adding the line if the column name is already found in the inserted table?

INSERT INTO scoreperdays (name,day1) VALUES ((select name from scores limit 1), (select score from scores limit 1))

Here are my examples ... but they do not work
Quote
 
 
+1 #10 Илья 2011-02-19 17:45 Thank you very clearly stated. Quote
 

Authorization

Nice Ajax Poll

Which one of my extensions is the best?

Statistics

Advertisement