With the explicit default feature, you can use the DEFAULT keyword as a column value where the
column default is desired.
• The addition of this feature is for compliance with the SQL: 1999 Standard.
• This allows the user to control where and when the default value should be applied to data.
• Explicit defaults can be used in INSERT and UPDATE statements.
DEFAULT with INSERT:
INSERT INTO departments
(department_id, department_name, manager_id)
VALUES (300, 'Engineering', DEFAULT);
DEFAULT with UPDATE:
UPDATE departments
SET manager_id = DEFAULT WHERE department_id = 10;
No comments:
Post a Comment