DO NOT USE this for questions targeting Microsoft SQL Server, use the tag sql-server instead. "SQL" is an acronym for "Structured Query Language", it is used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. ...

learn more… | top users | synonyms (1)

1
vote
2answers
16 views

MySQL - How to check whether all values of a given SELECTed row are equals?

Using MySQL, how can i SELECT all rows whose values are equals ? For instance, suppose a SELECT of a given table as follows COLUMN_A COLUMN_B COLUMN_C ... COLUMN_N 1 2 4 ...
0
votes
1answer
12 views

sub and sub-sub item organization system

So I am looking to find the best database design for the following situation. I will refer to my entities as 'articles' as that would best/most-easily describe them. So the articles have already ...
0
votes
2answers
34 views

Storing IP addresses - varchar(45) vs varbinary(16)

I am going to create a table with two fields - ID as BIGINT and IPAddress as either varchar(45) or varbinary(16). The idea is to store all unique IP addresses and use a reference ID instead the actual ...
2
votes
2answers
40 views

How to interpret correlated subqueries?

Correlated subqueries are highly confusing me. Example query from here: SELECT DISTINCT store_type FROM stores WHERE EXISTS (SELECT * FROM cities_stores WHERE ...
0
votes
1answer
30 views

updating same column as in the select query

When I try to do this, I get an error saying I cannot use the same table in where select as the column that I am updating. UPDATE table_name SET quantity = 19 WHERE productID = 148357 ...
-1
votes
1answer
14 views

Query issue for login page in asp.net? [on hold]

I would like to create a simple login page in asp.net. here is my code: protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(); ...
0
votes
1answer
34 views

SQL update multiple columns matching a pattern

I have a table in a postgresql database in which I have multiple columns matching a pattern /\w*(?:_open|_close)/g. Those are timefields. I would like to substract 1 hour from all the rows on those ...
1
vote
1answer
28 views

Reference column alias in same SELECT list

I'm converting an old MS-Access-based system to PostgreSQL. In Access, fields that were made up in SELECTs could be used as parts of equations for later fields, like this: SELECT samples.id, ...
5
votes
1answer
608 views

SQL Query challenge

I have what seemed like an easy query to write, that really has me stumped - can anyone help me please? So this is really easy on paper, but I can't translate it into SQL. Lets say you have some ...
-2
votes
1answer
22 views

Prioritised table query

I'm looking for a way to query two tables at once but ... I want the query to first run against Table A and then if Table A returns no matching records to query Table B. There many well be instances ...
4
votes
1answer
78 views

SQL “Standard” guide?

I am currently learning TSQL and am learning that were possible, I should use "standard" SQL dialect. Where can I find out which commands are "standard" and which are TSQL?
-2
votes
0answers
28 views

How to restore database? [on hold]

When you save metadata (added new column selection) from the translation of reference issued SQL error message: The log file for database '' is full. Back up the transaction for the database to ...
0
votes
2answers
30 views

Executing stored procedures asynchronously using tasks in SSIS

I have a stored procedure which is calling 20-30 stored procedures. I need these stored procedures to run asynchronously. From what I have read, it seems like executing those stored procedures using ...
-3
votes
2answers
47 views

optimisation for 4million + records [on hold]

I have a table full of addresses in one state. ID, address, state_id,region_id, suburb_friendly_url,street_name_friendly_url I have indexes on all of these fields. A cluster index on address. Doing ...
3
votes
2answers
163 views

sql querying for a pattern

I was hoping someone could steer me in the right direction with this one. I have a table that has student grades. Create Table StudentGrades ( StudentID references Student(StudentID) int not null, ...
0
votes
1answer
42 views

How to merge two databases, both with primary keys

I have two databases, both with the same tables, but the data is out of sync. I need to add data from database A to database B, but not overwrite any data in B that exists in A, instead add it with a ...
0
votes
1answer
25 views

delete query performance issue on mysql

I have two tables table1, table2 where table2 is a subset of table1 (basically created with the query create table table2 as select * from table1 where .....) Now, I am trying to run the below query. ...
-1
votes
1answer
24 views

Retrieve user Permissions on a database [on hold]

Please could you provide me query that shows user(John Felix) permissions on a server\database.
0
votes
1answer
19 views

Optimize Query in MySQL

I've following tables with respective fields 1) wi_individual_g(ind_id,ind_is_recepient,ind_deleted,ind_district_id,...) - Around 200K data 2) wi_individual_p(ind_id,prg_id,...) Around 250K data 3) ...
-1
votes
0answers
9 views

Can anyone convert this SQL into Rational Algebra Format [on hold]

select RATE.rname, RATE.boundary from RATE, ROUND, CANDIDATE where RATE.rname=ROUND.rname and ROUND.cname=CANDIDATE.cname and CANDIDATE.person_name=’Jacky’;
0
votes
0answers
4 views

Access 2010 delete and append queries run partially then give “Read Only” error

I have a number of append and delete queries written in Access 2010 that link to and modify tables on our SharePoint 2010 site. These queries have run without problem for months, but suddenly they've ...
2
votes
1answer
16 views

Linking SQL Server tables to a PostgreSQL Server

I have a SQL Server 2005 instance and also a PostgreSQL 9.3 running on the same network, I would like to know if its possible to somehow create or have 'views' on a database within the PostgreSQL ...
1
vote
2answers
20 views

How can I map a login to a database using T-SQL (not SSMS)

I'm writing a program that requires me to assign all permissions and everything in code. I have gotten stuck in this part: I just want to do the equivalent of clicking the little box under "Map" ...
1
vote
3answers
42 views

Script to drop all databases except one not working

I'm trying to drop all databases but one on my test server. For this, I'm using the below script but it gives error: EXEC sp_MSforeachdb ' USE [?] IF (DB_ID(''?'') > 4 AND DB_NAME()!=''ABC'') ...
1
vote
0answers
42 views

Is there a way to improve this query further?

I've got a query that over time I've been improving. Originally it simply selected * from the records table, and the data was formatted on the webapp side. But that was slow and I wanted to make ...
0
votes
1answer
38 views

SQL select with unique_list - losing an item

I have an oracle database and I have the following problem: If I make an select like this: SELECT fk_proddes_id,fk_id_cod_deseu, LISTAGG (TO_CHAR (cod_eliminare), ',') WITHIN ...
0
votes
0answers
40 views

Why is MySQL not saving inserted data?

So I have the following insert statement that I run through MySQL Workbench: INSERT INTO PeakOnlineCount (time_stamp, LocationId, Count) values ('2015-03-26', 0, 1) If I run the following query: ...
0
votes
1answer
21 views

oracle database - sql for counting the columns with the same id with the one in current row

I have an oracle database and a few tables and with this query: select rap.DENUMIRE,a3.ID,op.FK_ID, (SELECT COUNT(*) FROM ANEXA3_TABEL1_ROWS) AS count from ANEXA3_TABEL1_ROWS a3 inner join ...
0
votes
0answers
18 views

DB space vs query complexity tradeoff

I have a dilemma - Right now I have a query that I do constantly - joining 5 tables on different columns, calculate stuff per row, distinct on that, and do that with offset and limit (pagination). I ...
-2
votes
0answers
13 views

Can anyone tell me which programming language is from www.freelancer.com, www.clickbank, www.craigslist.org and www.pof.com? [closed]

I want to build a site like www.pof.com and advance search area is my favor (key word post and match and searching). Any one can tell me better, simple and easy to apply and manage in the future for ...
2
votes
1answer
30 views

How to keep updates (diffs) of some entity in the database

What is the best way to keep updates (diffs) of the some entity in the database? At StackOverflow we can edit questions and answers. And then we can look at any revision of the question or answer we ...
3
votes
2answers
33 views

Getting Machine name from where stored procedure was last executed

Is there any way to find out machine IP or machine name from where a particular stored procedure is executed in SQL Server 2005? We have a client server architecture with .NET as a front end and SQL ...
0
votes
0answers
11 views

Populating a table with data from a table that has the historical data on columns (SQL/plSQL 10g) [closed]

I have to populate a table with information from a table that has the historical data on columns. The source table name is source table xxtbl_source(client_id number, dec_14 number, nov_14 number, ...
-2
votes
0answers
11 views

What are Client Access Profiles and what are they used for?

Can someone please explain to me what Client Access Profiles are, and what they are used for? I have not able to find 1 single thing about them online in the past week.
-3
votes
0answers
24 views

Monyog for SQL Sever [closed]

I'm looking for a SQL Server Log Parser/Analyzer like Monyog for Mysql where I can load a log file and the parser can show me how often a query was executed (this is done by replacing literals so ...
0
votes
0answers
20 views

difference between phpmyadmin and php PDO

I'm running a query in Phpmyadmin and also execute the same query with php PDO but results are not equal. What could be wrong ? This is query : SELECT dim_date_key as date ,dim_jdate_key as jdate, ...
0
votes
0answers
20 views

Windows Server 2012 - Can't connect to database with PHP [closed]

I have problems connecting to my database. We have bought a cheap used windows 2012 IBM Server which is hooked up in our network. It has PHP 5.6 installed as well as SQL. I've only worked with ...
0
votes
1answer
24 views

Postgres - count of GROUP BY

I am trying to determine the total number of contributors in an image database who have contributed at least five images. The following query will give me counts of images by contributor, but that's ...
0
votes
0answers
19 views

trying to a lag a column in SQLite

Sorry if this is too basic for this forum, but I have had no luck in StackOverflow. I am a newbie to SQL. I am using SQLite. I have a table where rows represent individuals in a point in time. I am ...
0
votes
0answers
11 views

Why is my Make Table query pasting 0 rows?

I have 3 tables that I am trying to merge into 1 table using a make table query. They have thousands of rows of information. They all have multiple columns, but the first column on each will contain ...
0
votes
0answers
7 views

Push all SQL Server changes to a non-SQL Server platform [closed]

What is the best approach for capturing all the changes (all creates, inserts, updates, and deletes) and sending those into an external platform like Datomic for history/reporting/auditing? I'm ...
-2
votes
2answers
28 views

SQL SUM of different product groups in one query?

I have a table with the following columns: PRODUCT_ID | PRODUCT_NAME | GROUP_ID | GROUP_NAME | PRICE GROUP_ID and GROUP_NAME are not UNIQUE. Can I make a selection which just returns each GROUP_ID ...
0
votes
1answer
37 views

One Non-Clustered Index that covers every possible combination of predicates?

Say we have a table against which a number of different queries can be executed and each query has its own combination of predicates. So, for example, if we have a table with columns A, B, C, etc we ...
1
vote
1answer
169 views

How to set IN values on an update (SQL Server)? [closed]

Quick question, I did try to google but couldn't find an answer. I have 3 separate queries here, I want to do SET IN ('price1', 'price2', 'price3') but when I tried I got an error. How would I do ...
-2
votes
0answers
19 views

I want query postgresql group by month and type [closed]

I want query postgresql group by month and type like this, please help me.
0
votes
0answers
8 views

Query to get the values of a field from all tables

I have an Access database with several tables. Some tables have a column called Action. For some of my records, the Action is blank, others have text in it. How can I make a list of all records in ...
6
votes
2answers
70 views

What is an Oracle ASSEMBLY?

What is an Oracle ASSEMBLY, in the context of Oracle SQL? It's listed in GV$SQLCOMMAND. Although GV$SQLCOMMAND is not a perfect guide to "real" SQL statements - for example it has UPSERT instead of ...
0
votes
1answer
19 views

Scheduled Database Backup job fails due to lack of disk space

Two of my scheduled SQL Server backups failed over the weekend because of a lack of space. The C: drive has 25.3 GB of free space out of 400 GB. The primary space taker is SQL. 149.9 GB C:\Program ...
1
vote
1answer
112 views

How to return values from “upsert” query in case when UPDATE has been performed?

WITH upsert AS (UPDATE tbl SET a = 2 WHERE a = 1 RETURNING tbl.*) INSERT INTO tbl (a) SELECT 1 WHERE NOT EXISTS( SELECT * FROM upsert ) RETURNING * This "upsert" statement works however I would like ...
0
votes
0answers
18 views

outer join more than 2 tables in access [migrated]

After following this thread. I am getting an error as "Syntax Error in JOIN Operation" Here Is my query SELECT StudentMaster.Student_id, ExamDetails.Subject_id, ...