Tag Info

Hot answers tagged

13

Yes, storing strings instead of numbers can use more space. The reason that high-profile pltforms are doing it anyway is that they think the benefits of that solution are greater than the cost. What are the benefits? You can easily read a database dump and understand what it's about without memorizing the enum tables, and even semi-official GUIs might ...


4

The difference is not hidden - simply your examples don't illustrate it :-) Using INSERT TableName (Column1, Column2) VALUES ... syntax limits your options to values lists (as in your examples; note that the value list should be enclosed in parentheses.) or return value of stored procedure e.g. INSERT INTO Cities (Location) VALUES ( dbo.CreateNewPoint(x, ...


3

(The following answer uses SQL Server RDBMS to explain) First off, there are no temporary tables in your question. Temporary tables (in SQL Server) are actual tables that live in tempdb, and are defined with one or two pound signs (#) preceding it. What you have is a simple alias (temporary_data). Two extremely different things. That is an extremely ...


2

Because payments aren't negative. Ask any accountant. In most accounting ledgers, this would not only be intuitively incorrect, but physically impossible. If you want to make a negative payment, you issue a positive credit. Note that Quickbooks considers this data corruption.


2

Having an open connection and passing it between classes are generally a bad idea. Sure, opening a connection is quite a performance hit, but that's already taken care of by the connection pool by reusing already opened connections. A remark though: always wait as long as possible to call connection.Open(), especially in multithreaded code since this will ...


2

Passing an open connection to each class is probably not the best idea. Take a read of Creating database connections - Do it once or for each query? It recommends opening and closing the connection per each query you wish to run, rather than passing the open connection to your repository. You could try something like this to help you with managing your ...


1

Yes, storing things such as yes or true will take more space than a tinyint. This should not be surprising. It also makes indexing and thus joins less efficient for the database. It also has the penalty of possible confusion for what is the correct value (yes vs y). However, there are many approaches that look similar to storing strings in the database (in ...


1

If Agents had no associations to Department, i would do this : table Agents AgentID PK table Departments DepartmentId PK table Tickets AssigneeID FK to (AgentID OR DepartmentId) AssigneeType ('Agent' or 'Department') Then you can do : Select t.* ,coalese(a.name,d.name) as AssigneeName from Tickets t left join Agents a on a.AgentID ...



Only top voted, non community-wiki answers of a minimum length are eligible