![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 11365 Articles
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
74 Views
Let us first create a table −mysql> create table DemoTable ( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(40), ClientAge int, ClientCountryName varchar(40) ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ClientName, ClientAge, ClientCountryName) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
1K+ Views
To make a date column null, use ALTER TABLE and MODIFY and set the date to NULL. Following is the syntax −alter table yourTableName modify column yourColumnName date NULL;Let us first create a table. Here, we have set the column as NOT NULL −mysql> create table DemoTable ( ShippingDate ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
359 Views
The syntax is as follows to get the column names of a table −select column_name from information_schema.columns where table_schema='yourDatabaseName' and table_name=’yourTableName’;Let us first create a table −mysql> create table DemoTable ( EmployeeId int, EmployeeFirstName varchar(20), EmployeeLastName varchar(20), EmployeeAge int, EmployeeCountryName varchar(40), IsMarried tinyint(1), ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
374 Views
To check if field of a table has NOT NULL property, you can use any of the two syntaxes. The first syntax is as follows −desc yourTableName;Following is the second syntax −select column_name, is_nullable from information_schema.columns where table_schema = ‘yourDatabaseName’ and table_name = 'yourTableName’;Let us first ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
236 Views
To prevent a combination of items from being inserted twice, alter the table and set UNIQUE for the column as shown in the below syntax −alter table yourTableName add constraint yourConstraintName unique(yourColumnName1, yourColumnName2, ....N);Let us first create a table −mysql> create table DemoTable ( Value1 int, Value2 int ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
89 Views
For this, use BETWEEN -1 AND 1. Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(14); Query OK, 1 row affected (0.15 sec) mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
851 Views
For this, you need to use UNIQUE KEY for the column. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(30), UNIQUE KEY(FirstName) ); Query OK, 0 rows affected (1.76 sec)Insert some records in the table using ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
1K+ Views
Let us first create a table −mysql> create table DemoTable ( ProductAmount int, PurchaseDate datetime ); Query OK, 0 rows affected (0.94 sec)Note − Let’s say the current date is 2010-09-15.Insert some records in the table using insert command −mysql> insert into DemoTable values(567, '2019-09-10'); Query OK, 1 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
96 Views
Let us first create a table −mysql> create table DemoTable ( Subject text ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Introduction to MySQL'); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable values('Deep Dive ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
AmitDiwan
53 Views
Let us first create a table −mysql> create table DemoTable ( Joiningdate date ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2010-01-01'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('2010-03-31'); Query OK, 1 ... Read More