Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
164 views
in Technique[技术] by (71.8m points)

sqlite - what is bad in this table schema structure

I have got a table structure which is as follows:

`CREATE TABLE "pages" (
   "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
   "title" varchar(255),
   "body" varchar(255),
   "author" varchar(255), 
   "email" varchar(255), 
   "reference" varchar(255),
   "created_at" datetime,
   "updated_at" datetime);`

Is this table structure bad?

edit-1

Its sqlite database i am using.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Based on the limited info that you have provided. If the table fits your needs then no it is not bad.

However if you will have the same author with multiple entries. You might want to consider removing the author from your pages table and have a separate table for authors then use a foreign key relationship between authors and pages.

You could do the same thing with the email if you will have multiple emails for each author.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...