Database Articles

Page 291 of 547

How can I see the constraints which are applied to a table stored in the database I am currently using?

Samual Sam
Samual Sam
Updated on 19-Jun-2020 178 Views

MySQL SHOW CREATE TABLE statement will provide us the constraints applied to a particular table along with some other details about that table. Its syntax would be as follows −SyntaxSHOW CREATE TABLE table_name;Here table_name is the name of the table on which we want to see the constraints.ExampleIn this example we are getting the detail of the table named ‘employees’ −mysql> Show Create table employees\G *************************** 1. row ***************************        Table: employees Create Table: CREATE TABLE `employees` (    `Id` int(11) NOT NULL AUTO_INCREMENT,    `Name` varchar(35) DEFAULT NULL,    PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 ...

Read More

What is the difference between CHAR and VARCHAR in MySQL?

radhakrishna
radhakrishna
Updated on 19-Jun-2020 5K+ Views

CHAR and VARCHAR are both ASCII character data types and almost same but they are different at the stage of storing and retrieving the data from the database. Following are some important differences between CHAR and VARCHAR in MySQL −CHAR Data TypeVARCHAR Data TypeIts full name is CHARACTERIts full name is VARIABLE CHARACTERIt stores values in fixed lengths and are padded with space characters to match the specified lengthVARCHAR stores values in variable length along with 1-byte or 2-byte length prefix and are not padded with any charactersIt can hold a maximum of 255 characters.It can hold a maximum of ...

Read More

How to disable MySQL foreign key checks and what are the benefits ofndisabling it?

Rama Giri
Rama Giri
Updated on 19-Jun-2020 372 Views

We can disable foreign key checks with the help of the following statement −mysql> Set foreign_key_checks = 0; Query OK, 0 rows affected (0.00 sec)And we can enable it with the help of the following statement −mysql> Set foreign_key_checks = 1; Query OK, 0 rows affected (0.00 sec)Some benefits of disabling foreign key checks are as follows −After disabling foreign key checks we can load data into parent and child table in any order. Otherwise, we must have to load the data first in the parent table and then in the child table.Without disabling foreign key checks we cannot drop ...

Read More

What are the different ways to maintain data integrity in child table when the record is deleted in parent table?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 19-Jun-2020 399 Views

When two tables are connected with Foreign key and data in the parent table is deleted, for which record exists in child table too, then followings are the ways to maintain data integrity −On Delete CascadeThis option will remove the record from child table too if that value of the foreign key is deleted from the main table.On Delete Null This option will set all the values in that record of child table as NULL, for which the value of the foreign key is deleted from the main table.

Read More

Limitations of Database Management System

Kristi Castro
Kristi Castro
Updated on 19-Jun-2020 20K+ Views

Database Management System is quite useful compared to the file based management system. However, it does have some disadvantages. Some of those are as follows −More CostlyCreating and managing a database is quite costly. High cost software and hardware is required for the database. Also highly trained staff is required to handle the database and it also needs continuous maintenance. All of these ends up making a database quite a costly venture.High ComplexityA Database Management System is quite complex as it involves creating, modifying and editing a database. Consequently, the people who handle a database or work with it need ...

Read More

File-based Data Management System

Kristi Castro
Kristi Castro
Updated on 19-Jun-2020 18K+ Views

The systems that are used to organize and maintain data files are known as file based data systems. These file systems are used to handle a single or multiple files and are not very efficient. FunctionalitiesThe functionalities of a File-based Data Management System are as follows −A file based system helps in basic data management for any user.The data stored in the file based system should remain consistent. Any transactions done in the file based system should not alter the consistency property. The file based system should not allow any illegal or potentially hazardous operations to occur on the data.The file based ...

Read More

Why do we need a Database

Kristi Castro
Kristi Castro
Updated on 19-Jun-2020 19K+ Views

A database is a collection of data, usually stored in electronic form. A database is typically designed so that it is easy to store and access information.A good database is crucial to any company or organisation. This is because the database stores all the pertinent details about  the company such as employee records, transactional records, salary details etc.The various reasons a database is important are −Manages large amounts of dataA database stores and manages a large amount of data on a daily basis. This would not be possible using any other tool such as a spreadsheet as they would simply ...

Read More

Object-oriented Data Model

Kristi Castro
Kristi Castro
Updated on 19-Jun-2020 20K+ Views

Object oriented data model is based upon real world situations. These situations are represented as objects, with different attributes. All these object have multiple relationships between them.Elements of Object oriented data modelObjectsThe real world entities and situations are represented as objects in the Object oriented database model.Attributes and MethodEvery object has certain characteristics. These are represented using Attributes. The behaviour of the objects is represented using Methods.ClassSimilar attributes and methods are grouped together using a class. An object can be called as an instance of the class.InheritanceA new class can be derived from the original class. The derived class contains ...

Read More

How can we add FOREIGN KEY constraints to more than one fields of a MySQL table?

Srinivas Gorla
Srinivas Gorla
Updated on 19-Jun-2020 984 Views

MySQL allows us to add a FOREIGN KEY constraint on more than one field in a table. The condition is that each Foreign Key in the child table must refer to the different parent table.ExampleSuppose we have a table ‘customer2’ which have a Primary Key constraint on the field ‘cust_unq_id’ as follows −mysql> describe customer2; +-------------+-------------+------+-----+---------+-------+ | Field       | Type        | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | cust_id     | int(11)     | YES  |     | NULL    |       | | First_name  | ...

Read More

How can we remove composite PRIMARY KEY constraint applied on multiple columns of an existing MySQL table?

Govinda Sai
Govinda Sai
Updated on 19-Jun-2020 4K+ Views

We can remove composite PRIMARY KEY constraint from multiple columns of an existing table by using DROP keyword along with ALTER TABLE statement.ExampleSuppose we have a table ‘Room_allotment’ having a composite PRIMARY KEY constraint on columns ‘ID’ and ‘RoomNo’ as follows −mysql> describe room_allotment; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | id | int(11) | NO | PRI | 0 | ...

Read More
Showing 2901–2910 of 5,468 articles
« Prev 1 289 290 291 292 293 547 Next »
Advertisements