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.

learn more… | top users | synonyms

0
votes
0answers
14 views

Hybrid sql / nosql

I have a problem that doesn't seem to have an immediate fix and it confuses me. My main application stores data in mysql: Users Websites (metadata) Pages (metadata) The actual pages ...
0
votes
0answers
41 views

Pass the parser to the sorter, or pass the sorter to the parser?

I have 2 objects that I'm not very certain what is the proper (or better) way I should use. I have a query builder object that constructs an SQL statement like $qb = new SelectQuery('users'); $qb-&...
0
votes
1answer
39 views

SQL: Empty value list for the IN predicate (literals, not subqueries)

Recently, while writing some Spring/JPA code, I stumbled on an issue I tend to face with from time to time: I passed an empty collection to a repository method that generates an IN expression for the ...
-3
votes
1answer
94 views

Is SQL inefficient since it has to parse through everything?

As you know SQL doesn't have arrays. So if you make a table "article" and wish to have comments on your articles I presume you would make another table "comment". Inside "comment" table you have the ...
2
votes
2answers
58 views

Use one query that fetches redundant data from linked tables or multiple queries and join them in code?

I have three tables with a chain of two one-to-many relationships. There are two ways I can think of of fetching the data based on the primary key of the first table. JOIN each table (or LEFT JOIN ...
2
votes
2answers
96 views

Is a one-to-none relationship one-to-one or one-to-many?

I am working on an existing database design. There is one table in which each row is created with only half the columns populated (the remainder are initially all NULL, except for an is_populated ...
1
vote
2answers
26 views

what is a better approach in replicating data from table to another? triggers or a third party ETL tool?

We have multiple tables which we need to retrieve data from and dump to one centralized table. Currently what we are doing is running an ETL job made from Pentaho, retrieve the records from the source ...
-2
votes
0answers
26 views

How to track unread messages for a user in a multi-channel chat application

I'm building an multi room chat application similar to gitter/slack as a side-project. The database schema i have so far is: user table (userid,username) chatRoom table (roomname etc) user-chatroom (...
-1
votes
1answer
70 views

Sql vs nosql important data [on hold]

In one of youtubes videos about scalling web sites I found the statement that, however, in term of scallability, noSql is easier and more flexible, though it is better to use SQL for data important ...
-1
votes
2answers
200 views

Why use using-statements when you want to reopen connections? [closed]

In a Winforms project I've been working on recently, I've been dutifully using using-statements for objects that implement IDisposable. I want to reopen a database connection, however because the ...
1
vote
2answers
37 views

'first_name' vs 'name_first' for Grouping Similar SQL Columns

When creating a table with similar bits or data such as names. Is it preferred to have the column name prefixed with a common value? Consider a table to store user information. Looking at the columns ...
8
votes
9answers
325 views

Is it unnecessary to learn the kind of data structures and objects inside sql only because we are using another language to access db indirectly?

Suppose we are using java or python to access the database. Then is it considered a wastage of time and unnecessary to learn the kind of data structures and objects being used inside sql? Please ...
-1
votes
1answer
172 views

What's the best way to populate a new row in a database?

Is it possible to add a new row to a database using DataSet? When I created a new DataSet and dragged the table from the database I could see that in the DataSet methods there was one called insert ...
3
votes
2answers
166 views

Is there some rationale behind SQL's lack of closure for what are standard operations in imperative languages?

Is there some historical or practical reason why SQL (or more specifically T-SQL in my case) does not support the closure property in many areas where many other language families like C do? (That is,...
2
votes
2answers
132 views

How To Design Time Slot Based App

I have got a responsibility of designing an app which allocates time slots for doctors booking. The scenario is like, there'll be entry for doctors and their time slot for each days. For E.g. ...
0
votes
1answer
51 views

sql - How do I add child of child when dependent on parent

I'm building a wpf application which interacts with a sql database. I'm confused about adding children of children in my window. For example.. I just created a fishing trip so my fishing trip doesnt ...
0
votes
1answer
44 views

User, user Role and user Info, data base design problem

I am creating an application that will manage job interviews and help the employers to choose the job seekers based on a ranking system that's based on some user info. I've created a database that has ...
6
votes
2answers
110 views

Seeking benefits of both SQL and binary files in a data storage scheme

I'm looking for some input on how to keep certain benefits of both a binary file and a SQL database in an interesting data storage problem. I have a legacy custom binary file format that is ...
3
votes
1answer
60 views

Creating a service to to run logic / queries and update a table vs. running logic / queries on client refreshes

I'm not sure if this is a thing. I'm sorry about the ambiguous title--I wasn't really sure how to explain it. Basically I have a ASP.NET web page that runs two SQL queries and does some logic to ...
2
votes
2answers
47 views

When do I prefer a local DB over serialization for local data storage?

I recently started developing a small calendar application, in which I can add and view several calendar entries, which contain several data like name, date, alarm settings and so on. Those values ...
-1
votes
2answers
65 views

SQL query - split and run parallely?

I have a master table T1 which has 1000 records and a ColRef a key column. There are lots other tables all linked by ColRef. I have a Stored procedure which takes few hours to process. I want to ...
0
votes
1answer
117 views

How to setup multiple queries with slight differences

I'm writing a page that will show the user statistical data about some of our products. Basically the user can get results between a specific time frame, and also add on other data to lookup by. For ...
1
vote
1answer
44 views

Dynamic form builder with serialised sql storage

I have a requirement whereby my users will need to be able to build their own forms. Which they can specify different datatypes: Text DateTime Checkboxes All customisable mandatory/optional. I've ...
-2
votes
1answer
41 views

Get database after sql crash [closed]

One of the hard drive in my office's NT server was crashed two weeks ago. I had installed MS-SQL in c: and the data was stored in d:. The hard crased was c:. Thus I replaced the crashed hard drive ...
0
votes
2answers
54 views

Term OR word for specific type of a SQL table

I am looking for a Term/Word for specific type of tables. I have tried to search a lot, but I could not come up with best search terms for this. Tables that hold some master information, such as ...
0
votes
1answer
19 views

Best Azure Solution for Complex Search Index

I need to perform quick searches against a combination of tags while including date ranges: Example: Users who have requested notifications who did not respond to a notification sent at least 3 ...
2
votes
0answers
49 views

SQL - Locating closest value in a set

I have a table that contains the percentiles from a reference data set. CREATE TABLE [Core].[RiskFactor]( [SpecialtyCode] [char](2) NOT NULL, [RiskCategoryId] [int] NOT NULL, [Percentile] [tinyint] ...
6
votes
2answers
135 views

Does it make sense to use a cursor for complex business logic?

I am dealing with a pretty extensive data set. After a few joins, the foundation table has something like 40 columns. The next 40 columns will all be calculated. I am trying to keep my Java clean of ...
-1
votes
2answers
90 views

Does sql use hastables for indexes? [closed]

Are there other ways of indexing?, Which are the more used? Does sql have an standard for indexes, it uses hash tables?
2
votes
4answers
108 views

Data Model - How to better model this circular reference

I'm designing the data model for a project where users can create documents, save revisions of that document that can be reverted to, and publish documents. The basic data model I have right now is ...
1
vote
1answer
172 views

Getting data from a database with the MVC model

I am creating an application which will have a very large database to draw it's information from (a student registration system to be exact). The database is created with Microsoft SQL Server if that ...
3
votes
3answers
210 views

How to test data based on SQL queries?

I'm trying to set up a test framework for (SQL) datasets that get updated daily. I want to write assertions that involve comparisons between two tables–for example, the sum of column visitors in the ...
2
votes
1answer
228 views

How is one or more aggregate function implemented in most SQL engines?

In the book Database Fundamentals, Silberschatz. It is explained that aggregate functions can be calculated on the march. This make sense. What it means is that for calculating the maximun, average ...
-1
votes
3answers
195 views

What to do with database foreign keys in an entity class?

I know that an attribute defines the state of an object. So, is it correct to keep attributes that don't define the state of an object of a class? For example, I have an Employee class, which has ...
7
votes
4answers
263 views

Encapsulation for complex queries

I tried asking this question first on StakOverflow in a more concrete manner, but after being pointed here I realized I should rephrase it in more general terms; however, you can still review the ...
-1
votes
2answers
284 views

Registration form with email verification

Can someone point me in the right direction: I need to make a website with a registration form, to create accounts with e-mail verification, to write the forms content in a database table or something ...
2
votes
0answers
68 views

ODBC 3 Multiple Statements vs Multiple Connections

So right now I have a single thread to handle all the requests for the database. Let's say I have 400 requests per second for logins / logouts / other stuff, and 400 requests per second which are only ...
0
votes
1answer
70 views

Why storing a payroll in XML type field would be good or bad

We have a PAYROLL issues by the client to make it dynamic i.e. to make the whole process computerized. It includes: Employees Allowances (Scale wise, which could change yearly or monthly or ...
0
votes
3answers
117 views

Getting RowCount without wasting resources

I have a large SQL query that relates 6-7 different tables and returns fourteen different rows as distinct sets, in a union with an equally-large query, that at times can return over a thousand ...
1
vote
0answers
143 views

SQL Query and Java Constant Abuse?

I am currently charged with taking over a lot of code that is written with fields names placed into Java constant at the top of the file, and then the SQL queries constructed using string ...
1
vote
1answer
88 views

auto generated web CMS for pre-existing SQL db?

What I'm looking for is a way to auto-generate a simple web-based CMS for a simple pre-existing SQL database. To be used by 'app administrators', not the general public. Something that: allows ...
2
votes
1answer
60 views

More scalable alternative to a transaction-per.request in a SQL+REST stack?

I'm new in web programming with SQL database. So please forgive my ignorance. I'm using some modern framework to make a REST server with a SQL database. I'm using transaction only when I think I need ...
2
votes
2answers
367 views

SQL query or C# .net code for csv files import?

My aim here is to find out the best possible and feasible solution for my dilemma. I want to import some csv file (may contain around 50~60K records) into database after some manipulation into the ...
0
votes
0answers
18 views

Conceptually, how should a unidirectional multivalued relationship be implemented?

Ok, I'm trying not to upset the programmers list, but not so successful so far. My apologies. I'm trying to understand, conceptually and based on experience, which is the correct way for a JPA ...
4
votes
2answers
103 views

Why are triggers seen as a last resort to solve multiple paths in cascading deletes?

There is a problem using ON DELETE CASCADE on foreign keys in a SQL database if there are multiple paths from the root foreign key to the leaf. The way around this seems to be to replace the ON DELETE ...
2
votes
2answers
160 views

Why use JSON dataset rather than SQL Query?

A colleague was asking me to explain a system information flow, as they are having problems with the wrong information being presented. It seems that what they have created is a custom built website, ...
0
votes
1answer
149 views

Relationship between REST APIs and Databases [duplicate]

I've been studying databases and rest APIs lately and I have a question about the relationship between the two. Imagine I have a database with three tables, STUDENTS, ENROLLED, and CLASSES. STUDENTS ...
1
vote
0answers
137 views

Best practices for dashboard of near real-time analytics

I’m currently building a dashboard to view some analytics about the data generated by my company's product. We use MySQL as our database. The SQL queries to generate the analytics from the raw live ...
3
votes
4answers
121 views

Keeping a ratio column that's the division between two other columns

I'm about to build a SQL table where I want to store currency orders. That means that I need to store how much I paid for a certain quantity, and the ratio between both quantities. So for example: +--...
0
votes
0answers
21 views

SQL data model for nested milestones/timframes

I'm currently weighing different approaches to a data model and I'm curious what others would do. The main nugget of info is ACTIVITIES, which belong to a chain of milestone time releases. Stages ...