create table with date column in sql
mysql> create table DemoTable
(
StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
StudentName varchar(20),
StudentAdmissionDate DATE
);
Query OK, 0 rows affected (0.47 sec)
create table with date column in sql
mysql> create table DemoTable
(
StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
StudentName varchar(20),
StudentAdmissionDate DATE
);
Query OK, 0 rows affected (0.47 sec)
sql table
CREATE TABLE utilisateur
(
id INT PRIMARY KEY NOT NULL,
nom VARCHAR(100),
prenom VARCHAR(100),
email VARCHAR(255),
date_naissance DATE,
pays VARCHAR(255),
ville VARCHAR(255),
code_postal VARCHAR(5),
nombre_achat INT
)
create date sql
-- SQL Server
SELECT cast(cast(@year*10000 + @month*100 + @day as varchar(255)) as date)
-- Oracle:TO_DATE(string, format)
SELECT TO_DATE('2012-06-05', 'YYYY-MM-DD') FROM dual;
SELECT TO_DATE('05/06/2012 13:25:12', 'DD/MM/YYYY HH24:MI:SS') FROM dual;
-- SQL Server: CONVERT(data_type, string, style). Cf source link for style codes.
SELECT datefromparts(@year, @month, @day)
SELECT CONVERT(DATETIME, '2012-06-05', 102); -- Raises error if impossible
SELECT TRY_CONVERT(DATETIME, '2012-06-05', 102); -- Returns Null if impossible
-- MySQL: STR_TO_DATE(string, format):
SELECT STR_TO_DATE('2012-06-05','%Y-%m-%d');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us