SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

SQL INSERT Command with set option

By using set option we can insert record to any table. This is an alternate to insert command using value option of adding single record to the table. Here we have to use insert command at the beginning and use field names along with the value for the files with an equal to symbol. This is help full when we are handling more number of fields with one insert command; we can match the value to field name easily with out worrying about matching the value to filed names. In other words we can ensure proper value to the correct column. This is also useful when we are adding value to some fields and allowing default value for other fields. Here is an example of the sql insert command to add a record using set option.

Insert into library set book_name='Learning MySQL', author='plus2net group'

Related Tutorial
SQL Insert using VALUE option

This will add one new record to the table and values for two fields book_name and author gets added in the new record. This is quite helpful in matching field names to value.


Discuss this tutorial at forum

List of SQL Tutorials


 
Scripts
PHP
JavaScript
HOME
SQL Tutorial List
SQL (Home)
SQL Commands
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.