Tagged Questions

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

1
vote
5answers
67 views

Stored Procedures, ORMs and other application layers

I'm just starting out on a project to develop a new, fairly substantial web application which has an underlying MSSQL database. We're hiring a team of developers to write the application (in .NET) and ...
-1
votes
0answers
17 views

Get the Foreign Key table data along with Requested data [migrated]

I have two tables where one table Location References(using Foreign Key relation) to another Table. I am Using Dapper i want to Get the Location Details as well for the Given Customer Table. Like the ...
-2
votes
0answers
65 views

Checkedlist box select multiple checkboxes values insert to database [on hold]

I am new to working on vb.net 2008, want to know how to insert multiple selected checkboxes value from checkedlistbox in vb.net 2008 to sql server 2005 database. so I have two table in which fields ...
-5
votes
1answer
48 views

How best to design a SQL Parser in java, any prevailing design pattern comes to mind? [closed]

What software pattern is most useful for building a SQL Parser? I would like some ideas on how to even get started on something like this.
2
votes
1answer
137 views

An algorithm that spreads similar items across a list

I need an algorithm that distributes same items across a list, so maximizing the distance between occurrences. E.g. I have a list of 15 items: {a,b,c,c,c,d,e,f,f,f,g,h,h,i,j} The algorithm should ...
0
votes
0answers
9 views

how to show a result of 2 different queries in one? [migrated]

I am sorry if the question itself doesn't make much sense but let me explain. I have 2 tables: Medicine and Donations Medicine has: id_medicine medicine quantity and Donation has: id_donation ...
0
votes
0answers
4 views

how to use postgresql in Java [migrated]

I Installed postgresql and its driver which is "postgresql-9.3-1102.jdbc41.jar". And my directory seems like : > SQL > myJDBC.java > postgresql-9.3-1102.jdbc41.jar I have tried : ...
31
votes
3answers
1k views

Why is most SQL written in YELLING? [duplicate]

On MySQL at least, the following two queries are functionally identical: select * from users limit 0, 1000; SELECT * FROM users LIMIT 0, 1000; However, most example sites and most developers I've ...
0
votes
2answers
51 views

Efficient database access for related data

As an example for this question, consider a content management system that has a content database table which contains things like the page title and location as well as the content itself which could ...
1
vote
1answer
130 views

Best OOP pattern to use for creating a commandline SQL API for a proprietary json based company datastore

We need to create a SQL commandline tool for querying a proprietary json based datastore. I'll be using java. Any suggestions on the primary OOP design pattern I should use for building this API? ...
-1
votes
1answer
101 views

SQLDatabase: Read a lot of data at once and process in memory or read the data when I need it?

I'm not sure how to approach this problem. I require a big chunk of data records from the SQL server. This chunk is based on variables, so I don't know before what records I need. I need to do a large ...
1
vote
1answer
88 views

Database choice [closed]

I am working on a system where I am replacing and existing Cobol system with C#. For the database I have hit some requirement which I am having a hard time to find complete support for (tried SQLite ...
3
votes
3answers
201 views

Is there a 'standard' SQL that can replace all the various custom versions?

I have been writing SQL for over 10 years now. I am extremely proficient at it and have experience working in SQL Server, Oracle, MySQL, PostgreSQL, etc. While there are multiple standards out there, ...
2
votes
2answers
107 views

Combine union with distinct

Situation: I need distinct results from two tables, that both have duplicates. I would like to know if I should combine UNION and DISTINCT. Example 1 - Only use distinct SELECT DistinctValue FROM ...
15
votes
4answers
3k views

Databases: Where should the application logic run? [duplicate]

http://highscalability.com/blog/2010/11/9/facebook-uses-non-stored-procedures-to-update-social-graphs.html talks about how Facebook moved logic out of the database into the application in order to ...
1
vote
2answers
210 views

Organise C++ classes around SQL database

My question is about how best to organize C++ classes around a database model, and I understand this may appear very elementary. The software I propose to create will do the following. It is intended ...
0
votes
0answers
35 views

An algorithm to implement SQL's ORDER BY with TOP/LIMIT or OFFSET/FETCH

Is there a general algorithm to implement SQL's ORDER BY with OFFSET/LIMIT more efficiently than sorting all the records? The algorithm for a simple TOP x is easy enough. It takes one full pass ...
1
vote
0answers
128 views

Separation of concerns between repository and service in DDD with complex entities

This probably seems as an example of opinion-based question, but I'm actually looking for rationale on how to decide correctly, I believe there is a correct solution that can be backed by solid ...
3
votes
2answers
261 views

Does ODBC require any run-time software beyond an .exe file to run against MySQL and ORACLE SQL? [closed]

I'm writing a software [under Windows] in C++ which later needs to be able to connect to both MySQL and ORACLE SQL. Now the software needs to be as simple for the user as possible. Now I'm ...
0
votes
0answers
45 views

Database conceptual Question [duplicate]

When querying in database through PHP, is it good to open mysql connection before every query and close it as the query completes? or should we open the mysql connection as soon as the first query ...
0
votes
0answers
52 views

embedding LEFT OUTER JOIN within INNER JOIN

I am having some problems with one of the question's answered in the book "SQL FOR MERE MORTALS". Here is the problem statement Here is the Database Structure Here is the answer which I am ...
0
votes
2answers
92 views

Is it a bad practice to keep database schema scripts (DDL) and manipulation (DML) scripts in different modules

we have a project structure like the following "module-shared" module depends on "module-database" module and some other modules depend on "module-shared" but no other module depends on ...
4
votes
2answers
204 views

Entity Framework with no direct table access

There are some similar questions I've found here, but none of them fully answer the question I'm asking. Similar questions: here and here In my company, I develop C# .NET applications and our Server ...
1
vote
1answer
270 views

Should ORM data access methods be wrapped or used directly?

We're using an internally-built ORM. Each table is represented by a Model class, which inherits from a base model class that has a handful of methods like GetAll, GetWhere (to get rows with specified ...
-4
votes
1answer
89 views

what data storage method should I use? [closed]

I am currently writing a program and among other things need to store data. The program listens to two computers talking to each other in a known protocol (the program know what protocol it is,the ...
0
votes
2answers
51 views

Changing an int to be a string in PHP / MySQL Schema

Background I'm trying to decide the best way to manage a change in requirements. Currently when an admin is assigned to a ticket, the ticket header record is given an owner and the ownerID field is ...
-1
votes
3answers
178 views

What constitutes a good Database System(Java / SQL related) [closed]

I've given this so much research but still couldn't come to my own conclusion, before continuing this question I would like to give you a rough idea of my current situation. I'm 18 years old and have ...
3
votes
2answers
79 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 ...
0
votes
2answers
55 views

Managing unique data correctly in SQL

Here in Brazil we have a personal identifier called CPF. This identifier has a sequence of 11 digits and is unique for each Brazilian citizen. Possibly in other countries there is something like that ...
1
vote
1answer
128 views

Web-app filtering information client-side vs server-side?

I have a web-app that provides data (that is updated on an interval) for intranet users, who are able to filter information by location. I was having a discussion with a co-worker about whether that ...
0
votes
1answer
110 views

Refactoring a Single Rails Model with large methods & long join queries trying to do everything

I have a working Ruby on Rails Model that I suspect is inefficient, hard to maintain, and full of unnecessary SQL join queries. I want to optimize and refactor this Model (Quiz.rb) to comply with ...
0
votes
0answers
104 views

Javascript and SQL Lite (multi browser offline SQL/database query)

I'm in the elections division of my county and am trying to simplify a voter lookup method for our poll judges during election time. Currently we are using a clunky heavy application that the judges ...
0
votes
2answers
89 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 ...
2
votes
3answers
121 views

Managing database schema for a C++ app

I have an open source project (Cockatrice) that uses mysql for the server component. I'm planning some changes to the schema, but right now the only management I have is a script that runs the proper ...
2
votes
1answer
277 views

When deciding a Primary Key, can I use Date part of a DateTime field

I'm designing a payroll system I have designed a database with several tables and this question is related to following tables EMPLOYEE (Employee_ID [pk], Name,... etc) LOCATION (Location_ID [pk], ...
0
votes
1answer
106 views

Full Text Indexing Strategy for MS Excel Documents

Background As part of a broader application that allows users to search thousands of MS Office documents on a private network, I need to index and make searchable Microsoft Excel files. My basic ...
1
vote
1answer
33 views

Custom Domain or Attribute Reference Table or Both?

I'm designing my first real database and I'm weighing the pros and cons of how to enforce uniformity in my data. My first option is to create a custom domain and program my UI to only allow certain ...
0
votes
1answer
130 views

Simplifying data search using .NET

An example on the asp.net site has an example of using Linq to create a search feature on a Music album site using MVC. The code looks like this - public ActionResult Index(string movieGenre, string ...
1
vote
1answer
127 views

Dynamic Query Generation : suggestion for better approaches [closed]

I am currently designing a functionality in my Web Application where the verified user of the application can execute queries which he wishes to from the predefined set of queries with where clause ...
1
vote
0answers
78 views

Serialized values or separate table, which is more efficient?

I have a Rails model email_condition_string with a word column in it. Now I have another model called request_creation_email_config with the following columns admin_filter_group:references ...
1
vote
3answers
114 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 ...
5
votes
4answers
300 views

Direct database manipulation an anti-pattern?

Recently I learned that some teams have moved all their database manipulation to the actual database through the use of stored procedures. I thought that was pretty clever, since the database becomes ...
0
votes
0answers
40 views

Track time spent on site

We are going to track user engagement (i.e. time spent on site, most viewed part/page of the system, etc). I don't see Google Analytics / MixPanel being able to do this, since we have to analyze ...
1
vote
2answers
243 views

Can I create a query which allows me to do this?

I have a table which stores user information, one column stores their ID. I had implemented four different attributes in the same table which stored a bit indicating which file operations that user ...
-3
votes
3answers
1k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
0
votes
2answers
722 views

Large MySQL Batch Inserts From PHP: Run insert from script, or save as SQL file?

We have a large dataset that's current residing in many, many spreadsheets. I've been tasked with getting part of that data into our MySQL DB. When all is said and done, I will probably be inserting ...
0
votes
1answer
159 views

MongoDB: Replicate data in documents vs. “join”

Disclaimer: This is a question derived from this one. What do you think about the following example of use case? I have a table containing orders. These orders has a lot of related information ...
2
votes
1answer
171 views

Implementing Syncing between localStorage and SQL database?

I have made a simple web app, which runs completely offline - all data is saved in HTML5's localStorage. Now, I want the data to get synced with the server, so that the user is able to use the app on ...
2
votes
0answers
194 views

Is database version control practical? [closed]

The topic of database version control seems to come up at my work and in social discussion more and more often. But the truth is, I haven't met anyone actually DOING it. The only thing Googling the ...
0
votes
0answers
37 views

Charts, SQL and REST?

We have created a REST API for a voting game. Now we are jumping into creating analytics/graphs/charts for moderators and users to watch how are they doing in the game. The game has a certain group ...