Tagged Questions
111
votes
13answers
41k views
Why use a database instead of just saving your data to disk?
Instead of a database I just serialize my data to JSON, saving and loading it to disk when necessary. All the data management is made on the program itself, which is faster AND easier than using SQL ...
82
votes
10answers
10k views
Why is “Select * from table” considered bad practice
Yesterday I was discussing with a "hobby" programmer (I myself am a professional programmer). We came across some of his work, and he said he always queries all columns in his database (even on/in ...
62
votes
16answers
5k views
Co-worker renamed all of my queries [closed]
I don't know if I should be very irritated or what. I single handedly built over 300 queries for a large database, and developed a naming convention so I could find them later. No one else in my ...
56
votes
6answers
3k views
Is this a ridiculous way to structure a DB schema, or am I completely missing something?
I have done a fair bit of work with relational databases, and think I understand the basic concepts of good schema design pretty well. I recently was tasked with taking over a project where the DB was ...
39
votes
11answers
33k views
SQL: empty string vs NULL value
I know this subject is a bit controversial and there are a lot of various articles/opinions floating around the internet. Unfortunatelly, most of them assume the person doesn't know what the ...
35
votes
11answers
2k views
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 ...
20
votes
4answers
3k views
How do you decide what kind of database to use?
I really dislike the name "NoSQL", because it isn't very descriptive. It tells me what the databases aren't where I'm more interested in what the databases are. I really think that this category ...
16
votes
4answers
425 views
Database abstraction — is it being overdone?
After being exposed to numerous database abstraction layers, I'm starting to wonder what the point is of every library inventing their own different paradigm to access data. Picking up a new DAL feels ...
12
votes
6answers
1k views
Do You Still Need Indexing After Database Normalization
After you have done a good normalization, do you still need to index the table? How is this going to affect the performance? Will it even affect the performance in some way after a good normalization? ...
11
votes
5answers
1k views
At what size of data does it become beneficial to move from SQL to NoSQL?
As a relational database programmer (most of the time), I read articles about how relational databases don't scale, and NoSQL solutions such as MongoDB do.
As most of the databases I have developed ...
11
votes
4answers
887 views
TDD with SQL and data manipulation functions
While I'm a professional programmer, I've never been formally trained in software engineering. As I'm frequently visiting here and SO, I've noticed a trend for writing unit tests whenever possible ...
10
votes
4answers
1k views
Why do relational databases only accept SQL queries?
As far as I know, most relational databases do not offer any driver-level API for queries, except a query function which takes an SQL string as an argument.
I'm thinking how easier it would be if one ...
9
votes
9answers
3k views
Foreign key restrictions -> yes or no?
I would like to hear some”real life experience” suggestions if foreign key restrictions are good or bad thing to enforce in DB.
I would kindly ask students/beginners to refrain from jumping and ...
8
votes
4answers
4k views
Database History Table / Tracking Table
Currently I want to structure a tracking/history table like this:
PrimaryKey - ID
OtherTableId - fk
fieldName - name of the field its tracking
OldValue
NewValue
UserName
CreateDateTime
So ...
8
votes
4answers
612 views
Should database queries be abstracted out of the page itself?
When writing page generation in PHP, I often find myself writing a set of files littered with database queries. For example, I might have a query to fetch some data about a post directly from the ...
8
votes
3answers
427 views
How do you handle constantly changing database dimensions?
For the last two months or so I have been looking for solutions or practices to handle release management within databases. I'm looking for what people view as the best process for handling this.
We ...
7
votes
4answers
2k views
Best C# database communication technique
A few days ago, I read an answer stating that writing queries within your c# code are long gone.
I'm not sure what the specific person meant with the comment but, it got me thinking. At the company ...
7
votes
5answers
302 views
In retrospect, has it been a good idea to use three-valued logic for SQL NULL comparisons?
In SQL, NULL means "unknown value". Thus, every comparison with NULL yields NULL (unknown) rather than TRUE or FALSE.
From a conceptional point of view, this three-valued logic makes sense. From a ...
6
votes
6answers
846 views
Is the “One Description Table to rule them all” approch good?
Long ago, I worked (as a client) with a software which use a centralized table for it's codified element.
Here, as far as I remember, how the table look like :
Table_Name (PK)
Field_Name (PK)
Code ...
6
votes
1answer
839 views
Is inline SQL still classed as bad practice now that we have Micro ORMs?
This is a bit of an open ended question but I wanted some opinions, as I grew up in a world where inline SQL scripts were the norm, then we were all made very aware of SQL injection based issues, and ...
6
votes
2answers
1k views
Best method to implement a filtered search
I would like to ask you, your opinion when it comes to implement a filtered search form. Let's imagine the following case:
1 Big table with lots of columns
It might be important to say that this SQL ...
6
votes
3answers
465 views
Types of databases
I read that there exists three main types of databases
* Transactional (Client-Server database// OLTP database)
* Decision support system (DSS) (Data warehouse database // Data mart // Reporting ...
5
votes
4answers
2k views
C# Minimal SQL Database
I'm working on a small project (not production) where I'm needing to store enough data that something like a CSV would be inefficient to process and an SQL/MySQL server would be too much. Does .Net ...
5
votes
3answers
580 views
Should we have a database independent SQL like query language in Django?
Note :
I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries.
Once things starts getting complicated it is preferred to write raw ...
5
votes
4answers
493 views
Designing a Database Application with OOP
I often develop SQL database applications using Linq, and my methodology is to build model classes to represent each table, and each table that needs inserting or updating gets a Save() method (which ...
5
votes
2answers
671 views
Dependency analysis from C# code through to database tables/columns [closed]
I'm looking for a tool to do system wide dependency analysis in C# code and SQL Server databases. It's looking like the only tool available that does this might be CAST (CAST software), which is ...
4
votes
2answers
399 views
How deeply programmer should know about internals of database engine? [closed]
I am learning SQL Server 2012 along with C#. In the past, I took database class in college, and have good grasp on SQL language and can write queries. However, looking at SQL Server documentation (or ...
4
votes
4answers
2k views
DBMS agnostic - What to name the COUNT column from a SQL Query
I have trouble naming the COUNT() column from SQL queries and will swap between various variants
_Count
[Count] (sql, or "count" or backticks for MySQL etc)
C
Cnt
CountSomething (where "something" ...
4
votes
3answers
244 views
How to avoid unmaintainable code when using SQL in an MVC setting?
I want to present a list of products to the user. This list is paginated and can be sorted by the user by product ID or product name in ascending or descending order.
I am using an MVC setting, where ...
4
votes
6answers
126 views
Arguments for storing binary asociations in a single field vs. in a mapping table?
When do you draw the line between relational tables, and fields holding multiple values of a particular type. Let me illustrate in an example below where a PokeMaster can be associated to multiple ...
4
votes
2answers
5k views
Why NoSQL over SQL? [duplicate]
Possible Duplicate:
When would someone use MongoDB (or similar) over traditional RDMS?
How well the SQL and NoSQL go head-to-head. I read somewhere that SQL databases are not well for data ...
4
votes
2answers
728 views
Logic design question for SQL query
Was wondering if you could help me on a SQL problem I’m having.
I have a set of records of events where each event has a start time and end time. No event has the same start time, and the end time ...
4
votes
1answer
346 views
Designing a universal database driver class
I have a homebrew MVC framework that I have been using for a while, and it has been working great, but I am planning an upgrade to it for its ORM classes. So far, it only supports SQL databases by ...
4
votes
2answers
175 views
When and how much should we validate input when working with (C)AP storage?
Herein, we consider a server-client architecture. Suppose we keep the details flexible, but there's more than one layer of servers supporting our hypothetical service. The general question is "When ...
3
votes
7answers
4k views
What is the best approach for database design with lots of columns?
I am writing a query based financial application. It lets the user to write complicated equations (much like WHERE part of an SQL query) and find companies matching those criteria.
For the above, I ...
3
votes
4answers
796 views
Other things to learn for becoming a Database Admin/Developer?
Obviously i'll have to make some sort of choice at what DB i choose to go with (MS-SQL/MYSQL/etc) but this question isn't about that.
The question mainly is what other languages/tools would be ...
3
votes
3answers
394 views
Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?
I have some JSON data in this format (5,000 instances for now):
{"id":"123456","icon":"icon.png","caseName":"name of case"}
I am allowing the user to search for the name of the case and then return ...
3
votes
5answers
241 views
Violating SQL principles
I have to write a decent size database, 1GB more or less.
I have only taken an introductory semester regarding SQL databases. During the course we learned that the relational model under SQL has no ...
3
votes
2answers
1k views
Why is NoSQL better for this scenario?
Hypothetical scenario: Let's say we are downloading JSON from Facebook with details of a user's friend's checkins, posts, etc... These come in as one document per friend per activity, so with 8 ...
3
votes
1answer
180 views
Best way to rename existing unique field names in database?
I have a database table that contains id, filename, userId
id is unique identifier
filename should also be unique
table may contain >10000 records
When a user uploads a file it should be ...
3
votes
2answers
60 views
An algorithm for finding subset matching criteria?
I recently came up with a problem which I would like to share some thoughts about with someone on this forum. This relates to finding a subset. In reality it is more complicated, but I tried to ...
3
votes
5answers
993 views
Do you test your SQL/HQL/Criteria?
Do you test your SQL or SQL generated by your database framework?
There are frameworks like DbUnit that allow you to create real in-memory database and execute real SQL. But its very hard to use(not ...
2
votes
4answers
430 views
Job market-wise, are more and more companies moving to NoSQL? [closed]
I know NoSQL isn't nearly as mature, but it's been about a year or so since I've kept up with anything recent. Is it still "the future", are companies moving towards this, or are they still stuck in ...
2
votes
3answers
160 views
Referencing countries via Foreign Key Constraint
To make things simple to explain: I've got two tables: Table1 and Countries.
The Countries table contains a nice flag and some information, such as DisplayName, the ISO3166 ALPHA3 code and the phone ...
2
votes
2answers
799 views
Database for storing books by grouping, their pages, and the table of contents
I'm looking for a better way to deal with the design I have here, I'm not confident it's really suitable.
To give this some context, lets say we have a bunch of groups, one group could be "SQL", and ...
2
votes
2answers
325 views
Where should SQL/DB Queries be encapsulated in a software system?
I frequently write small applications (either web based or otherwise) that require heavy database usage. i've attempted various ways of handling where to put the actual sql queries (sort of ad-hoc ORM ...
2
votes
2answers
708 views
Database model for keeping track of likes/shares/comments on blog posts over time
My goal is to keep track of the popular posts on different blog sites based on social network activity at any given time. The goal is not to simply get the most popular now, but instead find posts ...
2
votes
1answer
407 views
Active Record library with support for both SQL and NoSQL?
I'm looking for a PHP Active Record library that supports both SQL and NoSQL drivers (mongodb in particular). It doesn't matter if it actually has the NoSQL driver, I can write it myself, as long as ...
1
vote
2answers
2k views
Using Autoincrement Primary keys as Foreign Keys
When creating a table, there is an option for us to set the numeric primary key as autoincrement where it's value increases whenever a new data in inserted.
This primary number can be used for ...
1
vote
3answers
100 views
Store history in SQL database column
We have a database that stores the process/history of particular machines. What I mean by that is that we have "started", "updating", "shutdown", and so on for all the computers in the company.
The ...