How to use a sql query to find pairs of attributes in a table that have each value of one attribute at any time correspond to one value of another attribute?

  • Why do you need it? The wording is very similar to the definition of the first normal form, and in it are all the databases to which you can write a SQL query. - kodv
  • you need to find the functional dependencies of the attributes on the attributes of the composite key in order to lead to 2 normal form. I am writing a program with # and I want to form a query to the database - Catherine
  • The question is incorrect. If you are still designing a database, it’s too early to talk about SQL queries. Elsi you expect that you will be given a script that you run, and your database is automatically designed in 6 normal form, then you are mistaken. It is necessary to learn the theory, and use the knowledge gained in the design of the database. Read at least Wikipedia, where most of the actions are accompanied by examples. " ru.wikipedia.org/wiki/… " - kodv
  • You must understand at the logic level whether there is a dependency or not. And life may well throw any situation and it will not be a violation of the NF. For example, I add two entries to a table with attribute1 equal to 5 and attribute2 equal to 10. At the same time, there are no other entries in the table with attribute1 equal to 5. The query will show you that the match is unique, but it doesn’t mean anything tomorrow 5-12 . the only question is whether your model allows you to store both 5-10 and 5-12 or not and if not - why - Mike

1 answer 1

By "at any time" in the formulation of the normal form (more precisely, in the formulation of the term Functional Dependence ) is meant any moment in the present, past and future .

SQL operates on data currently in the database. Using an SQL query, it is not possible to determine whether a match condition will be met in the future.

This can only be determined by analyzing the subject area.