View Constraints Applied to a Database Table

Samual Sam
Updated on 19-Jun-2020 13:30:26

143 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

CHAR vs VARCHAR Data Types in MySQL

Krantik Chavan
Updated on 19-Jun-2020 13:29:53

410 Views

Actually, both of these data types in MySQL store strings and can be set with a maximum length. The use of these data types purely depends on the need. Followings are some points which will make us clear that when one should CHAR and when VARCHAR −Suppose if we have fixed size of data, such as flags of “Y” and “N” then it is better to use CHAR rather than VARCHAR. It is because 1 byte of length prefix also used with VARCHAR. In other words, for the above kind of data, CHAR will store the only 1byte which is ... Read More

Difference Between CHAR and VARCHAR in MySQL

radhakrishna
Updated on 19-Jun-2020 13:27:55

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 65, ... Read More

Disable MySQL Foreign Key Checks and Their Benefits

Rama Giri
Updated on 19-Jun-2020 13:27:24

333 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

Database Operations in Java

karthikeya Boyini
Updated on 19-Jun-2020 13:27:08

2K+ Views

This article provides an example of how to create a simple JDBC application. This will show you how to open a database connection, execute a SQL query, and display the results.Creating JDBC ApplicationThere are following six steps involved in building a JDBC application −Import the packages: Requires that you include the packages containing the JDBC classes needed for database programming. Most often, using import java.sql.* will suffice.Register the JDBC driver: Requires that you initialize a driver so you can open a communication channel with the database.Open a connection: Requires using the DriverManager.getConnection() method to create a Connection object, which represents ... Read More

Maintain Data Integrity in Child Table When Parent Record is Deleted

Lakshmi Srinivas
Updated on 19-Jun-2020 13:26:49

363 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.

Coupling in Java

karthikeya Boyini
Updated on 19-Jun-2020 13:22:22

5K+ Views

Coupling refers to the usage of an object by another object. It can also be termed as collaboration. This dependency of one object on another object to get some task done can be classified into the following two types −Tight coupling - When an object creates the object to be used, then it is a tight coupling situation. As the main object creates the object itself, this object can not be changed from outside world easily marked it as tightly coupled objects.Loose coupling - When an object gets the object to be used from the outside, then it is a loose coupling ... Read More

Create Two-Dimensional Array in JavaScript

Nikitha N
Updated on 19-Jun-2020 13:21:23

767 Views

A two-dimensional array has more than one dimension, such as myarray[0][0] for element one, myarray[0][1] for element two, etc. To create a two-dimensional array in JavaScript, you can try to run the following code −ExampleLive Demo                                        var myarray=new Array(3);                  for (i=0; i

Create an Array of Strings in JavaScript

V Jyothi
Updated on 19-Jun-2020 13:19:50

12K+ Views

To create an array of strings in JavaScript, simply assign values −var animals = ["Time", "Money", "Work"];You can also use the new keyword to create an array of strings in JavaScript −var animals = new Array("Time", "Money", "Work");The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4, 294, 967, 295.ExampleLet’s see an example to create arrays in JavaScript −Live Demo                     JavaScript Arrays ... Read More

Properties of an Array Object in JavaScript

Syed Javed
Updated on 19-Jun-2020 13:18:59

5K+ Views

The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements of the same type.The following is the list of the properties of the Array object −Sr.NoProperty & Description1constructorReturns a reference to the array function that created the object.2indexThe property represents the zero-based index of the match in the string.3inputThis property is only present in arrays created by regular expression matches.4lengthReflects the number of elements in an array.5prototypeThe prototype property allows you to add properties and methods to an object.ExampleLet’s see an example of the prototype propertyLive Demo       ... Read More

Advertisements