Interview Preparation mode beta
Funny Facebook Status Funny Facebook Status
Enter your email address

How To Specify Default Values in INSERT Statement?

Nice?Vote!

1 Answer

Nice?Vote!
If a column is defined with a default value in a table, you can use the key word DEFAULT in the INSERT statement to take the default value for that column. The following tutorial exercise gives a good example:

INSERT INTO temp_links VALUES (102,
  'dba.tempsite.com',
  NULL,
  0,
  DEFAULT);
1 row created.

SELECT * FROM temp_links;
   ID URL                      NOTES     COUNTS CREATED
----- ------------------------ -------- ------- ---------
  101 dev.tempsite.com NULL           0 30-Apr-06
  102 dba.tempsite.com NULL           0 07-MAY-06
answered 1 year ago by siva (10,720 points) edited 1 year ago by R

Related questions