Structured Query Language (SQL) is a language for managing data in relational database management systems. This tag is for general SQL programming questions; it is not for Microsoft SQL Server (for this, use the sql-server tag), nor does it refer to specific dialects of SQL on its own.
1
vote
1answer
88 views
Formatting SQL statements [duplicate]
In recent years I've developed a habit of formatting SQL SELECT queries like so:
SELECT
fieldNames
FROM
sources
JOIN tableSource ON col1 = col2
JOIN (
SELECT
...
-2
votes
0answers
16 views
JPQL Query ManyToOne [closed]
JPQL query for both ManyToOne Unidirectional and Bidirectional Relationship
class ParentEntity{
@Id
String parentId1; //composite key
@Id
String parentId2;
...
2
votes
1answer
45 views
Testing MVC models when using SQL referential constraints
I have an MVC web app that's wired against PostgreSQL. The DB uses the full gamut of various referential constraints to ensure referential integrity, as opposed to say the Rails approach, where you ...
5
votes
1answer
171 views
Is SQL declarative?
I ask because so many of the questions I see in SQL amount to: "This is slow. How do I speed it up"? Or are tutorials stating "Do this this way and not that way as it's faster".
It seems to me that a ...
1
vote
1answer
29 views
SQL Table Design Modification based on data roles or implementation convenience?
I've got an existing SQL table structure that looks like this:
Orders
- order_id
- organisation_id
- [all the rest of the order data]
Organisations
- organisation_id
- [all the rest of the ...
0
votes
1answer
159 views
Databases, What underlying theory are MUST KNOWS [closed]
/Besides SQL and the dialects that exist with it, what underlying theory should an upcoming DBA definitely know?
Database Design? Modeling? Seems like there is quite a bit of topics, but what is the ...
1
vote
1answer
126 views
How can I maintain a SQL schema upgrade that goes out to our users on a regular basis?
I work on a project that uses a SQL database as a back end, and a desktop app as a front end. We do releases on a regular basis, and as part of a release, our client needs to update their SQL server.
...
2
votes
2answers
139 views
Saving user profiles in SQL database
So, I got a table UserProfiles in my database, that, similar to C#'s Settings file, holds a property with the appropriate datatype and the specified setting in the profile.
Now each time I add a new ...
-2
votes
0answers
38 views
How to make simple sql modifications from shell? [migrated]
I have never made any software for linux, but it would be better for me now. I would like to write a simple SQL modification software that I can run via terminal and don't need to run php, apache. ...
1
vote
3answers
202 views
Protect Database Design - SQL
Perhaps a bit of an odd question but I can't think of a way to achieve what I want.
I produce a product which ends up installed on-site at clients premises. It is a business critical and high ...
0
votes
1answer
39 views
What is the proper and easy way to move a LocalDB to Azure using code first ?
The only way I could figure how to do it was create the schema on the localDB with code first and then manually change the database string to Azure and then run the code on Azure.. But that only ...
2
votes
4answers
168 views
How to genericize foreign key references in table?
I am trying to design a table to store references to multiple tables as a "target" of the item in each row.
An example should clarify what I am trying to do:
Imagine you have 4 tables (images, ...
0
votes
0answers
51 views
Document existing Visual Studio Project [duplicate]
I am a small business owner and my sole developer quit. Cold. I am not a coder. He developed an existing application that works .net, c#, javascript, sql, visual studio based, 250,000 lines of code. ...
0
votes
1answer
339 views
Best place to write SQL queries
I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes -
QueryBuilder ...
1
vote
1answer
49 views
Visual Studio DBProjects and problem with it running post-build SQL (file too big)
What I am doing is creating a DBProject.. importing a DB.. then creating scripts in the PostBuild that are DATA scripts for each table (so that the post build can populate the tables after the schema ...
3
votes
7answers
396 views
OOP (php) for beginners - some unclarities
I started reading some tutorials about OOP, because I want to learn the basics.
I have a question about it. I understand how you can have a object "Car" and give it a color like this ...
2
votes
2answers
326 views
Best strategy in SQL
Recently, a colleague told me that it wasn't advisable to make conditions in the join clauses. Instead he suggested to make conditions in the where clause. He told me that the SQL engine was optimized ...
0
votes
2answers
162 views
ACID compliant Database that isn't NoSQL? [closed]
I'm not necessarily asking if a NoSQL database can be ACID compliant, which has been asked here:
Is there any NoSQL that is ACID compliant?
I'm wondering if we have a database either now or in the ...
1
vote
2answers
181 views
Are error codes wrong in SQL queries too?
I have an SQL query which does several things at once¹: it does multiple checks and then, if the checks pass, updates some data. Without entering in the domain-specific details, here's an imaginary ...
2
votes
3answers
120 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 ...
1
vote
2answers
190 views
Not using SQL Transactions
I am looking at a codebase where a developer never uses SQL transactions i.e. each update/insert into the SQL database is an atomic operation.
I believe the codebase would benefit from transactions. ...
0
votes
0answers
290 views
How to stay up to date as a programmer and developer [duplicate]
So I am going to college right now for computer science, and I am reading a lot of books on different languages that have nothing to do with my courses in school, and I found out that I am completely ...
-2
votes
2answers
112 views
Servers for learning SQL [closed]
I'm a python/haskell guy that is looking to learn SQL, specifically Oracle's version. Is there like a free Oracle server with dummy data so that I could play with it? I'll take an equivalent MySQL ...
2
votes
1answer
150 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 ...
0
votes
4answers
176 views
Create a database for database tables
I'm working on a project where I have to give users the ability to build their own tables,
each user can create more than one table.
(the type of all data is string).
The user can create a table and ...
-3
votes
2answers
311 views
Why do we still use a programming language instead of using just SQL? [duplicate]
In database managements systems lecture, my professor said that we can use Oracle etc. ui designing tools instead of using Visual C# or etc. He added that SQL is as strong as a programming language. ...
9
votes
4answers
580 views
Will working in IT limit your career prospects as a programmer? [duplicate]
I took a job working as an IT guy (SQL programming, helpdesk, etc.) because I had need of a job (to pay back student loans accumulated from school).
I'm very happy to have a job, but I eventually ...
0
votes
2answers
134 views
Should I retrieve one large set of data to filter or smaller individual sets of data?
I have a company intranet that utilizes a similar set of data across many different pages and many different methods.
Speaking in generalities, is it closer to "best practice" to retrieve a large ...
4
votes
4answers
973 views
why are noSQL databases more scalable than SQL? [duplicate]
Recently I read a lot about noSQL DBMSs. I understand CAP theorem, ACID rules, BASE rules and the basic theory. But didn't find any resources on why is noSQL scalable more easily than RDBMS (e.g. in ...
0
votes
3answers
159 views
How to maintain user relationship when user unfollows another user
I have a table of user relationship which stores who follows whom, the table structure is as follows
-id
-follower
-following
when someone follows any other user, I add a record with follower user ...
10
votes
4answers
962 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 ...
2
votes
2answers
366 views
Why OTServs have an item cloning problem if the server crashes? [closed]
OTServs are open source MMORPGs with a huge community. Mostly all of them have a serious problem: if the server crashes, people can clone items. This is a dirty trick that can be executed because the ...
91
votes
12answers
30k 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 ...
1
vote
2answers
134 views
Is NoSQL a good fit for a graphing app, and how can I compare different NoSql Servers?
I am traditionally a MsSQL or MySQL developer - I have been prototyping a new application that involves storing data from many targets.
I have seen that the app appears to get slow after scaling to ...
1
vote
1answer
113 views
Database data structures for RESTful api
I am creating a RESTful API. I am struggling to decide on the best way to design my database tables around my resources.
Initially, I though a table per resource would be a good way to go, but I'm ...
2
votes
1answer
89 views
Internationalization through SQL Database and performance issues
I'm using .Net technologies and because ASP.Net "instant translation" is not really easy to do with ResX, since it has to be compiled after every change, there are a few hacks available ...
2
votes
2answers
494 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 ...
-1
votes
1answer
144 views
Development paradigm: SQL programming vs using SQL to program [closed]
I would like to know what are the pros and cons to two apparently valid philosophies regarding the programming of an application which makes extensive use of a database.
The first philosophy is to ...
-1
votes
1answer
93 views
Database Connection Variable Name [closed]
What are the most well known / commonly accepted variable names used for the SQL connection itself?
In Perl, I have seen $dbh (stands for database handle, but why 'handle'), which has been used only ...
4
votes
2answers
205 views
Formatting SQL Based on an AST
I am working on my .NET open source project for generating SQL...
Initially, I wrote the project so it spit out exactly one SQL format... ugly. I started using this project in the real world and ...
6
votes
4answers
320 views
Good idea to move logic out of SQL statements?
I'll preface this question by saying that I am very new to professional software dev.
I work on a team that takes data in from other groups in my company and turns this data into reports usable by ...
4
votes
2answers
167 views
How would I make a suggestion for a change to the SQL standard
If I wanted to make a suggestion to a change to how the UPDATE statement works in SQL, how would I go about it?
Is there a website for the next standard?
I googled, but just kept getting the ...
4
votes
1answer
172 views
Algorithm to denormalize database
I have built a QlikView script generator (QVS), that can be used to generate large script files for data imports from SQL Server to QlikView.
QlikView does not like 'fully' normalised database ...
3
votes
1answer
346 views
Is Clojure a 3GL or a 4GL?
A bit of background (in case I'm mistaken)...
I think I understand that (it's an oversimplification):
manually entering codes into memory (or on a punchcard) is "first generation language"
using ...
1
vote
1answer
103 views
Is Neo4j graph database sufficient to itself for all query types?
Neo4j eases relationship traversals => especially useful for a social network for instance.
But are there any scenarios when it's advised to associate an additional relational database (or other ...
7
votes
4answers
456 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 ...
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? ...
0
votes
1answer
199 views
For PL/SQL, do large companies prefer ANSI SQL joins or old Oracle joins? [closed]
I am interviewing for a PL/SQL position with a large corporation. I will have to write a multiple choice exam. I am wondering whether the exam will likely use old-style joins (joining happens in the ...
1
vote
1answer
168 views
Static Tables vs Dynamic Entity Attributes Storage Configurations
I am trying to figure out a better way to decide table storage configurations whether it will use static configurations using tables or dynamic configurations using EAV (entity-attribute-value)
When ...
8
votes
4answers
363 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 ...

