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)

3
votes
1answer
116 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 ...
1
vote
0answers
23 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
25 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 ...
-1
votes
1answer
14 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
45 views

optimisation for 4million + records

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
156 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
38 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
20 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
23 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
3 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
14 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
39 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
28 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
34 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
39 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
20 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? [on hold]

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
32 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
10 views

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

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 [on hold]

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
19 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 [on hold]

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
23 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 [on hold]

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
24 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)? [on hold]

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
68 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
18 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, ...
2
votes
1answer
25 views

Search for authors whose records are separated by at least X days

I am using Postgres and have a table which contains metadata about several million images - many of which have the same author. I am looking for contributors who add content regularly - not people ...
0
votes
1answer
28 views

Oracle can't drop index with . in name?

I am trying to drop an index that has a dot(.) in its name and can't seem to do it (I'm logged in as the SYSTEM user, which owns the index). Any ideas? SQL> select index_name,owner,status from ...
0
votes
0answers
12 views

Oracle Linked Server on SQL partial insert

I am using OpenQuery to insert into OracleLinkedServer, inside a while loop from while ( @id <= @cnt) Begin INSERT INTO OPENQUERY ( MY_LINKED_SERVER,'SELECT COL1, ...
1
vote
1answer
22 views

db schema for a object with multiple foreign key tables

I have a question table which contains question_id, question_text and choice_type_id ( say freetext, binary choice and multiple choices ) Now, the question table (which has question_id, ...
1
vote
2answers
68 views

How to enforce data consistency across one-to-one relationship in an inheritance hierarchy

Consider this design for a typical school database: Person: ----------------- FirstName LastName SocialSecurityNumber Phone Email Student: ----------------- Grade Teacher: ----------------- ...
2
votes
1answer
59 views

Updating table of versioned rows with historical records in PostgreSQL

I have a master table of versioned rows: CREATE TABLE master ( id SERIAL PRIMARY KEY, rec_id integer, val text, valid_on date[], valid_during daterange ); INSERT INTO master ...
0
votes
0answers
19 views

Why isn't user being shown in DBA_USERS?

I have created a user and I wanted to know it's default_tablespace but whenever I run SELECT query for showing default_tablespace or anything it says no rows selected.How can I resolve this issue? ...
0
votes
0answers
23 views

Sql*PLUS: Output each field as a new line

Right now the configuration I have is the following: set pagesize 0; SET NULL *NULL*; SPOOL output/output.txt I am outputing the results to a text file in order to run a function on the file to ...
1
vote
1answer
18 views

Stop PostgreSQL from logging statements on error

My postgresql 9.3 logs are sprinkled with entries like these (redacted to protect the guilty): STATEMENT: INSERT INTO table (key, value) VALUES ($1, $2) ERROR: duplicate key value violates unique ...