Questions tagged [rdbms]
68 questions
129
votes
14 answers
Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else?
Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have…

lucaswxp
- 1,379
- 2
- 8
- 10
62
votes
11 answers
Should I define the relations between tables in the database or just in code?
In my experience, many of the projects I have read in the past didn't have relationship definitions in the database, instead they only defined them in the source code. So I'm wondering what are the advantages/disadvantages of defining relations…

Yoshi
- 747
- 1
- 5
- 7
49
votes
9 answers
Why is filesystem preferred for logs instead of RDBMS?
Question should be clear from its title. For example Apache saves its access and error logs in files instead of RDBMS no matter on how large or small scale it is being utilized.
For RDMS we just have to write SQL queries and it will do the work…

Yasir
- 1,229
- 3
- 13
- 14
49
votes
12 answers
Why don't relational databases support returning information in a nested format?
Suppose I'm building a blog that I want to have posts and comments. So I create two tables, a 'posts' table with an autoincrementing integer 'id' column, and a 'comments' table that has a foreign key 'post_id'.
Then I want to run what will probably…

PreciousBodilyFluids
- 703
- 5
- 7
30
votes
4 answers
Why many designs ignore normalization in RDBMS?
I got to see many designs that normalization wasn't the first consideration in decision making phase.
In many cases those designs included more than 30 columns, and the main approach was "to put everything in the same place"
According to what I…

Yosi Dahari
- 602
- 7
- 17
22
votes
4 answers
Why not just make non-parameterized queries return an error?
SQL injection is a very serious security issue, in large part because it's so easy to get it wrong: the obvious, intuitive way to build a query incorporating user input leaves you vulnerable, and the Right Way to mitigate it requires you to know…

Mason Wheeler
- 82,151
- 24
- 234
- 309
19
votes
10 answers
Why don't RDBMSes return joined tables in a nested format?
For example, say I want to fetch a User and all of his phone numbers and email addresses. The phone numbers and emails are stored in separate tables, One user to many phones/emails. I can do this quite easily:
SELECT * FROM users user
LEFT JOIN…

mpen
- 1,889
- 19
- 29
19
votes
3 answers
Why aren't Object Oriented databases used as much as Relational Databases?
I have come across many relational database management systems (RDBMS). But recently I used hibernate which made me start wondering why Object Oriented databases aren't more popular.
If object oriented languages like Java or C# are so popular, then…
user65878
16
votes
5 answers
When not to use ORM and prefer stored procedures?
I am using PetaPoco micro-ORM. It is indeed very easy and secure to work with databases using ORM tools, but the only thing I hate is extra code. I used to put most of the code in the database itself and use all the RDBMS features like Stored…

RPK
- 4,378
- 11
- 41
- 65
14
votes
9 answers
Should a surrogate key ever be exposed to a user?
Often in a table that has no natural key, it is still useful for users to be able to have a uniquely generated identifier. If the table has a surrogate primary key (and in such a case you would certainly expect it to) should that key be exposed to…

psr
- 12,846
- 5
- 39
- 67
13
votes
4 answers
Do these specific tables need surrogate keys?
Background
I have this tables
+-------------------------+ +------------------------+
|Airport | |Country |
|-------------------------| |------------------------|
|airport_code string (PK) | |country_code string…

Tulains Córdova
- 39,201
- 12
- 97
- 154
11
votes
2 answers
In what order are rows fetched absent ORDER BY clause?
One programmer is testing and comparing the same application which uses the same database structure, and the same data, only in two separate databases, one with Oracle 8 and one with Oracle 9.
The app runs a query with no ORDER BY clause.
He claims…

Tulains Córdova
- 39,201
- 12
- 97
- 154
9
votes
2 answers
Is there a canonical source supporting "all-surrogates"?
Background
The "all-PK-must-be-surrogates" approach is not present in Codd's Relational Model or any SQL Standard (ANSI, ISO or other).
Canonical books seems to elude this restrictions too.
Oracle's own data dictionary scheme uses natural keys in…

Tulains Córdova
- 39,201
- 12
- 97
- 154
8
votes
5 answers
Predicting advantages of database denormalization
I was always taught to strive for the highest Normal Form of database normalization, and we were taught Bernstein's Synthesis algorithm to achieve 3NF. This is all very well and it feels nice to normalize your database, knowing that fields can be…

Janus Troelsen
- 279
- 2
- 16
7
votes
3 answers
Do common relational database systems work 'out of the box'?
I'm quite new to software development and whenever I come across small projects which involve storing (relational) data I always ask myself if something like a micro-blog (or any other project with few users that stores few types of data) really…

One One
- 89
- 1