[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
Sun » CppStdioH » The GPRMC Sentence » QbasicFAQ_Mouse » scripting » CppCodeSnippets » Bill Gates » Programmer » QbasicFAQ_Double buffer » CurlApplications » SQLInsert

(SQL) INSERT

The INSERT statement allows you to insert data into a database. It's syntax is as follows:-

INSERT INTO tablename (field1, field2, field3)
VALUES ('value1', 'value2', 'value3')


Where tablename is the name of the table we want to insert the data into, the first set of brackets contain the fields you want to insert data into and the second set of brackets contain the values to go into those fields (in the same order as the fields were listed).

Note that if it is a numerical data type, you put 9 instead of '9' in the VALUE clause.

You can also do an INSERT by selecting data from elsewhere; in this case you omit the VALUES caluse and write a SELECT statement in its place; the order of the fields in the SELECT clause of the statement should match up with those in the INSERT INTO clause.

last edited (October 23, 2006) by bilderbikkel, Number of views: 8532, Current Rev: 6 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Site Management by Lars Hagelin at Kontantkort.se.