This winter holiday season, give a precious gift to your career by upgrading your skills. | Get Flat 15 - 20% OFF on All Courses | Save Today

[iqquestion id=14]

16 thoughts on “Database : Basics of Database Discussion 5

  • Jitendra Singh

    There are various kind of constraints which we can impose on our tables. These are primary key, unique, default, check etc.

  • Jitendra Singh

    I forgot adding primary key and foreign key too which we can impose on tables.

  • karim

    constrains are:
    1- not null means columns can not have null
    2- Unique: ensures that each row for a column
    must have a unique value.
    3- primary key: a combination of a not null
    and unique.
    4- Foreign key: The refrential integrity of
    the data in one table to match value in
    another table.
    5- Check: Ensures that the value in a colums
    meets a specified condition,
    6- Default: specified default value when
    specified none for value.

  • Pamela halbhavi

    Constrains are database objects that restrict the data that a user or application program can enter into the columns of a table. In other words Constrains enforce the integrity of the database automatically without creating the triggers, rules or defaults. Different types of constraints –
    1. Default Constraint: Used to insert a default value in the column in the absence of data.
    2. PRIMARY KEY Constraint: Is a unique identifier for each and every row within a database table. Primary key are used to enforce entity integrity. Only one Primary key can be created for the table.
    3. UNIQUE: The Unique key constraints also uniquely identifies each record in the database. You can create more than one Unique key on the table unlike the Primary key.
    4. FOREIGN KEY: A foreign key is a column or group of columns in a relational database table that provides a link between the tables two tables . It maintains referential integrity between the table by cross referencing the Primary key in the other thereby creating the link between the two tables(So that you cannot delete the parent record unless the child records are removed).
    5. CHECK Constraint: A CHECK Constraint is a type constraints that which specifies the condition to be met by each row on the table.
    6. NOT NULL: The NOT NULL constraints enforces a column to NOT accept NULL values. It enforce the field to always have some value.

  • Jitendra Singh

    Can someone provide real example? Please take a table, figure out various columns and its datatypes. Please post your answer here? Thanks!!

  • Essa

    Constraints are used to specify rules for the data in a table
    1-not null=column can not store null value
    2=unique=each row or column must have unique value
    3-primary key=combination of not null and unique
    4-foreign key=ensure the referential from one table to another
    5-default=specifies a default value

  • nabeel

    They are database objects that define restriction or rule.
    Primary key
    Not Null
    Foreign key

  • nasir

    A constraint in a database is a rule that is programmed into the database which ensures that everything entered into the database is as accurate as possible and not subject to human error. A constraint can be defined on table level, column level or domain level.
    Types of constraints;
    Default constraint – is used to insert a default value into a column
    Primary key – is a unique identifier for a row and only one primary key constraint can be created for each table. In employee table in an entity, employee_ID will be a good choice for a primary key in the employee table.
    Unique – Unique constraint provide a guarantee for uniqueness for a column. A primary key constraint automatically has a unique constraint defined on it.
    Foreign key – is a column is a relational database table that provides a link between data in 2 tables. It acts as a cross reference between tables.
    Check – which specifies a requirement that must be met by each row in a database table.
    Not null – enforces a column to not accept null values. For example in employee_ID in table not null.
    Index – to create and retrieve data from database very quickly.

  • Palwinder

    Primary key
    Not Null
    Foreign key

  • ranjan

    Database constraints are user-defined structures that let you restrict the behaviors of columns.they are:
    Primary key
    Not Null
    Foreign key

  • collins

    the different type of contrains are
    forign key
    not null

  • Olubunmi Ogunsola

    Constraints are sets of rules to help maintain the databases integrity. Primary, unique(primary is a unique constraint), foreign key, default, and not null
    – Tomiwa

  • bruno

    Constraints define certain properties that data in a database must comply with. Common kinds of constraints are:
    – not null
    – unique
    – primary key
    – foreign key
    – check

  • sivi ramesh

    NOT NULL – column cannot store NULL value
    UNIQUE – each row for a column must have a unique value
    PRIMARY KEY – Primary Key is a column which has a unique value for each of the row within that column. It can’t have NULL value
    FOREIGN KEY – Ensure the referential integrity of the data in one table to match values in another table
    CHECK – Ensures that the value in a column meets a specific condition
    DEFAULT – Specifies a default value when specified none for this column

  • krishna shrestha

    A constraint is usually associated with a table and if a table has various kind of constraint like that, primary key, not null, foreign key,default, unique,check so that is constraint.

  • smriti

    A constraint in a database is a rule that assures the information entered in the database is correct and accurate.The various constraints in a database are:
    Primary key: Cannot have a null value
    Foreign key: Relation between two tables
    Unique: Should contain a Unique value
    Check: Check whether value stored is true or false
    Not Null: Value cannot be null

Leave a Reply