
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
In the previous lesson we discussed needing these columns for our table:
If you gave it an attempt- hopefully you ended up with something like this:
CREATE TABLE Posts (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(100) NOT NULL,
content TEXT NOT NULL,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
All of the types and clauses and constraints should be familiar- except maybe the use of .
is just like . They're both used to store strings of data. Except is better for long amounts of text. We use for data we can assume the max length of- and TEXT for large blobs of text like a blogpost or a message board post.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.