Time
7 hours 36 minutes
Difficulty
Beginner
CEU/CPE
3

Video Transcription

00:00
All right, Welcome back to Model five Sequel development. This is less than one skimmer development, and we're currently in sub lesson 1.6 implementation of the article model.
00:10
Now, with respect to the article model, there's a couple things we need to consider. First of all, there seems to be multiple types that we can have tutorials reviews, news articles. Now do we need multiple tables? Do we need a tutorial table reviews table and a news article stable?
00:27
I don't think we do. I think we can implement a type column so we'll create a articles table that has a type column that indicates what type the article is. I think I will work just fine and allow us to have one table and reduce some complexity of our database by having fewer tables.
00:45
And what else did we have? We had
00:48
can only be edited or deleted by the owner or admin, So to facilitate
00:53
who the owner is, we're gonna add a author I D column that indicates the author,
00:59
and we also see that it can have multiple images.
01:03
Multiple images is actually going to be its own table, so we're not gonna worry about that right now
01:07
because the Emperor will be in images table
01:11
that has that stores the images for the articles.
01:15
Now, with that said, let's start making the articles table. But we left Click on tables,
01:19
right click and select. Create new table.
01:23
Well, go ahead and name is articles.
01:26
Go ahead and create a new column.
01:29
Call it the I d. Calm.
01:32
We're gonna make that a big and unsigned
01:34
and it's not allowed to be. No, it has to be filled in
01:38
select. Okay,
01:40
Now most articles have a title, so we're gonna go ahead and add a title column. March are 100 should cover. The title's gonna say that it cannot be No. So it has to have a value.
01:52
We're gonna add another column. I'll call it in the body,
01:57
and we're going to change this from March are 100 which is most certainly not enough for an article body.
02:04
I'm gonna change that to text, which means it could be a large amount of texts which should cover
02:10
on article of the almost any size, so we'll go ahead and click. Okay,
02:16
let's go ahead and add in our constraint for the primary key,
02:22
so select I d
02:23
click. Okay,
02:24
We're gonna head back to columns.
02:27
Now. We need to add the author i d column
02:30
so that we know who wrote the article.
02:31
So, author, I d
02:35
And we know that's gonna be a big an unsigned, because that's what we are making all our keys.
02:39
You say that cannot be? No. Somebody offered the article. It needs to be filled in.
02:46
Okay.
02:47
And now we need to add our type column. So we're gonna say type
02:52
and Bart Starr 100 should be fine for the different types. Uh, shouldn't really exceed that character life
02:59
gonna click, Okay,
03:00
Gonna go ahead and click
03:02
that click save.
03:06
Persist.
03:07
We're gonna go ahead and turn on the auto increments.
03:10
So the idea feel takes care of itself.
03:15
Persist.
03:16
And that completes our article stable.
03:19
I hope you were able to get the article stable implemented, and I'll see you in the next lesson. Thank you.

Up Next

Introduction to SQL

This introductory SQL training teaches SQL core concepts that can be applied in professional environments. Once students complete this course, they will be able to query and interact with an SQL database, and know how to design database schemas.

Instructed By

Instructor Profile Image
Kitt Parker
Instructor