![]() ![]() Here, SALARY column is set to 5000.00 by default, thus in case INSERT INTO statement does not provide a value for this column, then by default, this column would be set to 5000.00. Exampleįor example, the following SQLite statement creates a new table called COMPANY and adds five columns. The DEFAULT constraint provides a default value to a column when the INSERT INTO statement does not provide a specific value. Exampleįor example, the following SQLite statement creates a new table called COMPANY and adds five columns, three of which, ID and NAME and AGE, specifies not to accept NULLs. If you do not want a column to have a NULL value, then you need to define such constraint on this column specifying that NULL is now not allowed for that column.Ī NULL is not the same as no data, rather, it represents unknown data. PRIMARY Key − Uniquely identifies each row/record in a database table.ĬHECK Constraint − Ensures that all values in a column satisfies certain conditions.īy default, a column can hold NULL values. UNIQUE Constraint − Ensures that all values in a column are different. ![]() NOT NULL Constraint − Ensures that a column cannot have NULL value.ĭEFAULT Constraint − Provides a default value for a column when none is specified. Column level constraints are applied only to one column, whereas table level constraints are applied to the whole table.įollowing are commonly used constraints available in SQLite. ![]() This ensures the accuracy and reliability of the data in the database.Ĭonstraints could be column level or table level. These are used to limit the type of data that can go into a table. Constraints are the rules enforced on a data columns on table. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |