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

-3
votes
0answers
28 views

Swap or migrating to new technology from Vb6.0 [on hold]

Hi I have exp in Visual basic 6.0 and it's late to change my technical career but I have to do. Can you please advise which is the good technology to switch.
-1
votes
0answers
15 views

Read subset of rows from a data table and post it in json and render it on a browser in table format

I have a data table that contains large number of records returned from the database, Currently browser gets all the records and are rendered on browser using client side pagination. Is there a way to ...
0
votes
0answers
23 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 ...
1
vote
0answers
65 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
43 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 ...
-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 ...
1
vote
1answer
45 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 ...
-3
votes
1answer
97 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 ...
22
votes
9answers
4k views

Should a primary key be immutable?

A recent question on stackoverflow provoked a discussion about the immutability of primary keys. I had thought that it was a kind of rule that primary keys should be immutable. If there is a chance ...
4
votes
2answers
2k views

Best practice in application design / SQL authentication

I am currently involved in the implementation/design of an existing application for a large scale customer. The application has a similar model as e.g. vCenter Server whereby a number of components ...
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
3answers
209 views

Designing Pricing table (RDBMS agnostic)

I'm designing a pricelist table for my database. It will include Customer, Model, Start_date, End_date, Price, Currency, RRP When I update a new pricelist which is sent every now and then (maybe ...
8
votes
9answers
326 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 ...
2
votes
2answers
99 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 ...
3
votes
3answers
1k views

Should I use foreign keys in my database if I use laravel?

I'm creating a website with Laravel for the first time. I checked relationships documentation today and it seems that Laravel just uses simple SQL queries. class User extends Eloquent { public ...
2
votes
2answers
63 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
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 ...
0
votes
1answer
118 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
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
28 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
71 views

Sql vs nosql important data [closed]

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
202 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 ...
3
votes
2answers
167 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
183 views

Configurable tables in SQL database

I have the following tables in my database: Configuration Table: ====================================== Start_Range | End Range | Config_id 10 | 15 | 1 ============================...
2
votes
2answers
136 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
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 ...
19
votes
9answers
7k views

Whether to put the business logic in Stored Procedure or Not?

There is always a debate over the topic - "Whether to put the business logic in Stored Procedure or Not?". If we decide not to use the ORM Tool and not to put the Business Logic in Stored Procedure ...
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 ...
-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 ...
3
votes
1answer
62 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 ...
0
votes
1answer
459 views

Address search from large text file

Basically I want to develop a Address lookup(part of my project) using C# (and I can use SQL if necessary). I have a very large text file which have all the UK address and postcodes. Addresses needs ...
14
votes
3answers
5k 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 ...
2
votes
2answers
48 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
vote
3answers
217 views

How to maintain user relationship when user un-follows 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 ...
-1
votes
2answers
288 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
1answer
43 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 ...
3
votes
1answer
113 views

Django Migrations: Binds data to code?

If you have custom code for models (custom validators and custom fields are examples), Django Migrations will import them directly into the migration files. An example: file web/models.py def ...
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
20 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
vote
1answer
89 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 ...
-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 ...
2
votes
1answer
229 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 ...
0
votes
3answers
801 views

What is selection and what is projection

I am working on Android with the query() method of the ContentResolver class and it accepts 6 parameters, (uri,projection,selection,selectionArgs,sortOrder,cancellationSignal) for selection and ...
1
vote
1answer
175 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
223 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 ...
7
votes
4answers
267 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 ...