Date Data type In SQL

Safalta Expert Published by: Saksham Chauhan Updated Tue, 20 Sep 2022 12:35 AM IST

Highlights

Check Date Data type In SQL Here At Safalta.com

In MySQL, a variety of data types are supported. When storing data values, we may need to use the DATE data type. When a value has a date component but no time component, the DATE type is utilised. It shows DATE values in the format "YYYY-MM-DD." Any date value that falls between the specified range of "1000-01-01" to "9999-12-31" can be stored. Syntax :  Variable_Name DATE.  Click Here To Download  e-book for MS Excel blog

Source: Safalta.com

The examples that follow will show you how to utilise the Date data type in a variable.

Example 1:

 

Establishing a Student

Information table
Student Id, First name, Last name, Date of Birth, Class, and Contact Details columns make up this list. among which the Date Of Birth column's data type is DATE.

Free Demo Classes

Register here for Free Demo Classes





Data entry into the Table -


Use the following command as follows to verify.

SELECT * FROM StudentDetails ;

Output :



Therefore, the DATE data-type has been correctly placed in the Date Of Birth Column.

 

Example 2: 

building a table of orders
There are columns for the OrderNumber, OrderDate, ShippedDate, and DeliveryDate. The OrderDate, ShippedDate, and DeliveryDate columns all have the data type DATE.


Inserting data into the Table –


Use the following command as follows to verify.

SELECT * FROM Orders;

Output :

Related Article

21 Great Search Engines You Can Use Instead of Google

Read More

How to build a content calendar

Read More

Best 30 Social media marketing tools

Read More

B2B Marketing Personalization : How to keep it personal and safe

Read More

CUET UG EXAM 2024: A Guide for Students

Read More

Top 10 Tips to Optimize for Google’s Featured Snippets

Read More

Reel Success: Tips for Creating Engaging Video Content

Read More

How to increase website traffic, best way to increase traffic

Read More

What is Genetic Algorithm and Why is Important ?

Read More