Skip to content
Advertisement

Tag: one-to-many

SQL- Get results based on four dependable tables with relations

I am trying to write sql query for a problem I am facing, but I can not get my head around it. I have team_member table with team_id and member_id. role table that stores roles with team_id (..name, slug) team_member_role table that is a many-to-many relationship between team_member and role (contains team_member_id and role_id). role_ability table, which stores role_id. (..action,

is it violate 2NF?

My table book PK ID INT pfK langID INT title VARCHAR description MEDIUMTEXT releaseYear YEAR chaptersPrice DOUBLE thumbnail BLOB Where pfk – Primary-Foreign Key; {ID, langID} – PK; chaptersPrice – price of each chapter of book. Example: BookName1: chaptersPrice=2 BookName2: chaptersPrice=3 I think in this table some attributes are functionally dependent on the part of primary key (ID): {ID} ->

Is table order imporant in mysql when creating relation between them?

I have quite simple question. I am creating database administration tool, where user will be able to create relations between tables, but I am not sure if table order is important when creating relations. For example: I have two tables ‘user'(user_id(INT, PRIMARY KEY), name(VARCHAR), email(VARCHAR)) and ‘post'(post_id(INT, PRIMARY KEY), content(TEXT), author(INT)). When user has selected one column from both tables

Advertisement