Jump to content

relationship type?


Destramic

Recommended Posts

hey guys im trying to workout what relationship my tables are: one to one, one to many, many to many.

 

here are my tables and query

 

news

---------

news_id

user_id

news

----------

 

users

---------

user_id

username

---------

 

news_comments

--------------

news_comment_id

news_id

comment

------------

 

query:

SELECT n.news_id, n.news, n.date, n.time, u.username,
	count(nc.news_id) AS comments
	FROM news n
	LEFT JOIN news_comments nc ON n.news_id = nc.news_id
	LEFT JOIN users u ON n.user_id = u.user_id
	Group by n.news_id

 

now i just want to know if im correct by saying my users table is one to one and the news_comments is one to many...im just trying to learn....thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.