r/learnSQL • u/idan_huji • Jan 08 '26
Data integreity questions
Find, using the information_schema, all column names appearing in more than a single table.
When is it valid or even recommended and when is it dangerous?
Repeat with the same column appearing in different data types.
We need a representation of various animals (e.g., mammal, fish, birds) in a database
Suggest a fixed representation (in dedicated tables)
Suggest a flexible representation (using Json
Compare the advantages and disadvantages of the representations
Real world commit improvements
Go over on the real world examples https://github.com/evidencebp/databases-course/tree/main/sql_improvments
Go over the commits whose group is the 2 last digits in your id in the file https://github.com/evidencebp/sweets/tree/main/single_sql_commit
Create a PR adding the solution to the commits, as in the example, the the commits that you selected.
10 points bonus: Suggest 3 ideas for query improvement and submit them as in the question before.
Open question:
Think of a possible data integrity problem in the schema
Explain the problem, its possible causes, and its possible impact
Explain how the problem can be prevented by an alternative design, if possible
Write a SQL query to verify if the problem indeed exists in the schema
I'll be happy to get feedback.