Database news with gallery, categories as year and subcategory

Database news with gallery, categories as year and subcategory



at the moment I'm working on database project news with gallery. I would like to know, if I thinking in a good way, or not.


news
------
idNews (P)
title
content
CategoryId (FK)
PublishedDate


gallery
--------
idGallery (P)
idNews (FK)
Image


category
---------
idCategory (P)
categoryName



P - Primary Key,
FK - Foreign Key



For Example:
After adding some rows into a news, in the same time a part of the information about news must have to be add into the other tables like gallery (image),subcategory( as 'test'), and category( '2018' ). This is a good idea of my database project, or not? What If in 2019, someone wants to add some images into the same subcategoryName as 'test'? If this is not enough information, please ask me anything you want.





You cann add column year in category table and to be part ok pk, also sub category should be info about the category not the news you can create a table news_info or news_desc for that.. by the way it depends on ur model if you want image name to be unique then (same image doesnt have the same name) then name should be in pk and add year column.
– Moudiz
Aug 22 at 18:17






In category table, I would like to contains information like: '2016/2017', '2017/2018', and then I will want to receive images which have that category. Is it clear?
– Damian99
Aug 22 at 18:25





For good data modeling and later performance its better you put column start year 2016 and other column end year 2017 and the you can get that category.. is that what you want? For ex select * from category where start_date ='2016' and end_date ='2018'
– Moudiz
Aug 22 at 18:29






This database will be for my school, and this table probably contains string '2016/2017', I didn't see their database yet so I really don't know, how to do that. That's only my idea. @edit: I think, that u have a really nice concept. I have never working on a large database ( I'm a student ), so my brain is tight :|
– Damian99
Aug 22 at 18:33






Ok so whats your question? I adviced you in my previous comments if not that what you want then please explain more
– Moudiz
Aug 22 at 18:35





1 Answer
1



You can add column year in category table and to be part ok pk, also sub category should be info about the category not the news you can create a table news_info or news_desc for that.. by the way it depends on ur model if you want image name to be unique then (same image doesnt have the same name) then name should be in pk and add year column.



For good data modeling and later performance its better you put column start year 2016 and other column end year 2017 and the you can get that category.. is that what you want? For ex select * from category where start_date ='2016' and end_date ='2018'.



For example if you want the data between 2015 and 2020 its better to day where start date ='2015' and end date ='2020' then to sort th3n while they are 2015/2016 or 2016/2017






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế