An acronym for "Structured Query Language" (it's not the name of a specific DBMS product), SQL can be used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. It can also be used to manage schemas and data ...

learn more… | top users | synonyms (1)

1
vote
0answers
32 views

Allowing users access to SQLPLUS and to compile PLSQL [duplicate]

As a DBA - assuming my users are knowledgeable with PLSQL and SQL - why would I not grant my users privileges to compile and run their own PLSQL code. We have an MI database environment where the data ...
0
votes
3answers
34 views

Allowing users to compile / run PLSQL and SQL

As a DBA - assuming my users are knowledgeable with PLSQL and SQL - why would I not grant my users privileges to compile and run their own PLSQL code. We have an MI database environment where the data ...
1
vote
0answers
14 views

Convert a list into one row with dynamic column in MySQL [duplicate]

I have a list of row to be converted into a dynamic column that depends on the record in one particular column. From this statement FID |Steps | Action ---- |------|-------- 1416 | 1 | Sit ...
2
votes
0answers
25 views

Wich is the most efficient/easy way for end-user to get data from Analysis database?

I know that you can quey a cube by connecting from excel to Analysis database and using formulas like cubevalue() or cubemember(). I also know that after converting the power pivot to formulas you can ...
1
vote
0answers
35 views

How to query sum all the wins of each team

Matches ID| radiant_name | dire_name | radiant_win 1 | LV | LGD | true 2 | LGD | LV | false 3 | LV | LGD | false 4 | LV | LGD | false ...
6
votes
2answers
196 views

Is this update, select combination query thread safe?

I have a table called seats, which has a schema like this id,taken For each user, I take a random untaken id and assign to that user, here for simplicity say, I make taken =1. The query I am ...
1
vote
1answer
48 views

How to restrict access to current user record and its rights in postgres

Postgres 9 database contains additional information about postgres users: create table public.user ( user char(10) primary key, -- CURRENT_USER in postgres name char(30) ); and user roles; ...
0
votes
1answer
68 views

MySQL-How to find that value in a column is subset with all other values in same column multiple time

I have a table named as Team where table contain 3 column (ID,Team,Task). Its datatypes are (INT,VARCHAR(255),INT). Below you will find a sample table where I would like to perform the query on column ...
2
votes
2answers
50 views

Multiple Instance with different service packs in SQL Server

I would like to install a Default instance with SQL Server 2008 R2 RTM and I want to install another named instance with SQL Server 2008 R2 SP2. Is this possible?
4
votes
0answers
214 views

There is insufficient system memory in resource pool 'internal' to run this query

One of our production servers is reporting an error in the log Error: 701, Severity: 17, State: 123. There is insufficient system memory in resource pool 'internal' to run this query. I ...
0
votes
1answer
39 views

Reviewing Stored Procedure template for handling transaction?

I've prepare a template for SQL Server stored procedures which will have Insert, delete, Update transaction. I have a stored procedure to log error in catch block in a table. How can I improve my ...
0
votes
0answers
45 views

select sequential rows

How would I go about selecting a sequence of rows. Where every row in the sequence: Must only be 1 day apart ~ Thereby the whole sequence of rows must have sequential dates Must have a count higher ...
2
votes
1answer
37 views

Changing feature on a database that is a member of SQL Server AlwaysOn availability group

Our developers need a change on a database that is in the Availability group (they need Service broker in one of the databases to be enabled) but when I try to do it I am getting error saying that I ...
2
votes
3answers
70 views

Bulk Delete for Large Table in MySQL

I have a Notification table contains about 100 million rows host in Amazon RDS with 1000 IOPS, and I want to delete those rows older than one month. If I do DELETE FROM NOTIFICATION WHERE CreatedAt ...
1
vote
1answer
24 views

CONCAT() between different alphabet echoes out '&' ampersand

I want to concatenate different alphabet strings and get a weird latin encoding with ampersands after the sixth greek character (I want to concatenate greek and english alphabet strings). Lets say I ...
0
votes
2answers
56 views

How to use max function in such condition?

My query is select * from guestuser union select * from olduser ORDER BY userid DESC LIMIT 1; Is that correct query to find last userid from different table have different userid? can i change ...
2
votes
1answer
43 views

I am Trying to Write an Access Query to Get a person having a First Name and Last Name but not all People having any of those names

I am using Microsoft Access. In my search form I have 3 text boxes that I enter text to search for: First Name; Last Name; Last 4 of SSN. With the current query when I enter text into multiple boxes ...
1
vote
0answers
20 views

MySQL - Transactions and causality

I'm new to MySQL's LOCK and TRANSACTION and have a question about different isolation levels of a transaction: Given two transactions executing the same code (auto-commit is false): (1) get data of ...
0
votes
0answers
60 views

Improving Statistics for Query Plan [on hold]

I have a table with over 2.1 million rows. This table has a column rID, which joins to a PK on another table. As you can see from the distribution below, most rows contain a null for rID; which ...
0
votes
2answers
42 views

SQL: TSQL to Find invalid views

we have a Tuesday/Thursday Maint window for one application we support. On Tuesdays we modify one facility and thursday if there are no errors we roll all the changes out to the other facilities. The ...
3
votes
2answers
140 views

Database Implementations of ORDER BY in a Subquery

I am using an application (MapServer - http://mapserver.org/) that wraps SQL statements, so that the ORDER BY statement is in the inner query. E.g. SELECT * FROM ( SELECT ID, GEOM, Name ...
-1
votes
0answers
44 views

SQL Server is very slow [closed]

In company with 30 clients(computers), after 3-4 hours working with financial software, SQL Server is very slow SQL Server can not free used memory and the query execution time is very slow but after ...
1
vote
1answer
44 views

Join select queries on an id in SQL Server

I have three tables that SELECT from and I'd need to join the results. It feels like this should be a rather easy task but I struggle with the syntax. Working on Microsoft SQL Server Enterprise ...
0
votes
1answer
62 views

Insert values in table from front-end CategoryId

I want to add a value from front end into a table. I want to do it in asp.net. I have a table which is as below:- CategoryId int CategoryName nvarchar(50) not null ParentId ...
0
votes
0answers
29 views

Left Outer Joins in Access

I'm working on an existing Access database trying to implement some changes which will allow the estimation of cutting times for my employer (We're an industrial company who fabricate Flight Cases). ...
0
votes
1answer
31 views

Multiple left join hangs server

i've got problem with left join query. It connect's 3 tables and calculate sales value for categories. Query: SELECT categories.name, categories.id, ...
0
votes
0answers
27 views

INSERT missing FK rows at the same time

I found on this site the following SQL-Query to perform an insert (see this post): WITH sel AS ( SELECT val.description, val.type, f.id AS foo_id FROM ( VALUES ('testing', ...
0
votes
0answers
17 views

change display of rows into column using PIVOT in sql server [migrated]

This is my query: select d.disposition, count(a.serialnumber) AS SUBTOTAL FROM FADB a, FARepair b, Disposition d WHERE a.ID = b.ID AND b.DispositionID = d.DispositionID GROUP BY d.Disposition and ...
0
votes
0answers
13 views

Installing printer_php.dll onto an azure website

Has anyone been able to get this extension running on a php based azure website? The extension just basically allows you to print stuff with your printer. I've configured my php.ini to find the ...
0
votes
2answers
38 views

SQL Performance: COUNT or extra attribute?

If I want to count the number of a multivalued attribute, which way is faster: a) using COUNT(attribute) on a whole table or b) adding an extra attribute which counts these stored values (to be ...
0
votes
1answer
35 views

How to design a query that gives count of different parameters based on different condition from a single table

I have a table books containing columns as bookid, issue_date,return_date. Once a book is issued from library an issue_date corresponding to it is made into the table while return_date can have valid ...
0
votes
1answer
27 views

SQL: return values as column table

I am running this query to get all returns for a list of tickers: select return1 from STOCK_DATA where TDATE between 20130101 and 20131231 and TICKER in (SELECT DISTINCT TICKER FROM STOCK_DATA) ...
0
votes
0answers
46 views

Table design for optimum performance

For example let's say I have to create a table called Employee with columns EmployeeID, Name, DOB, Address, DepartmentID[FK]. So I create the table as follows with a primary key and a nonclustered ...
0
votes
1answer
38 views

Mysql pagination without offset

Let's assume I have got a table with these data: I want to order it by createdAt column DESC, and id column DESC select id, createdAt from post order by createdAt desc, id desc Now it looks like ...
0
votes
1answer
36 views

where in (sub query) vs join

just want to ask about how to optimize my query. because i feel efficiency using join instead of "where in" sub query can someone enplane the deference SELECT C.Customer_id, C.tran_id, ...
0
votes
0answers
28 views

MySQL: How to get all values in “TICKER” column`? [migrated]

I never used SQL before, I want to get all values in "TICKER" from this database: The first statement select TDATE, price, return1 from STOCK_DATA where TDATE < 20131231 and TDATE > ...
-1
votes
0answers
16 views

Template for MySQL database upgrade script

What is the equivalent of this Microsoft SQL Server upgrade script template for MySQL? I want to upgrade my database version in repeatable transactions in sequential scripts as I develop an ...
-1
votes
3answers
62 views

What is wrong with this INSERT Statement

I am trying to use this statement to insert new data into my orders table like so: $tsql2 = "INSERT INTO pedidos (numero_local, emailUser,codigopapel,cantidad, color) VALUES ('$local', '$emailOn', ...
1
vote
3answers
58 views

does the mere existence of a primary key increase query speed for large data sets?

So, I have a table with about 2.4M rows and ~30 columns. There is no unique column within the data. The data is transaction logs from stores where each transaction number is only unique on a per store ...
0
votes
1answer
48 views

Secondary File Group is not online in SQL Server

In my database there are two file groups PRIMARY and SECONDARY. The .ndf file is in SECONDARY file group. I just wanted to backup only the secondary file group. So ran following T-SQL... BACKUP ...
6
votes
3answers
129 views

Most cost efficient way to page through a poorly ordered table?

I have a table that has three columns: HashUID1, HashUID2, Address_Name (which is a textual email address, and the previous two hash colunms are of some crazy creation to link event participant tables ...
1
vote
0answers
45 views

Handling SQL updates for production deploys

I'm researching for quite a long time now (about two months) and haven't found a good approach for this, so I'll ask you experts out there in the hope of some enlightenment. I run a pretty ...
1
vote
2answers
80 views

TSQL substitute for MAX() string ranking

I have a table with repeating values (col1) and I need to return col2 based on a ranking system. In my example the ranking system is handled by MAX() giving me the highest value. I then return the ...
0
votes
0answers
15 views

SQL Server 2008 R2 - Replication - Multiple Publications on a single database

I have hit a problem and I need an idea of where to look or how to resolve. I have setup a publication and 2 subscriptions to it, 1 running on a schedule and the other running continuously. I need ...
0
votes
0answers
40 views

Thoughts on further optimizations

So I have this application. It runs on a server. There is a portion of the code that is taking around 10-15 seconds to run, it contains some queries, logic, as well as some code to update the ...
1
vote
3answers
88 views

Clustered Index improvemens for particular queries

I found a table that looks like this: CREATE TABLE [dbo].Table1 ( id INT primary key IDENTITY (1, 1), [idUser] INT NOT NULL , [Amount] INT NOT NULL , [Attempts] INT NOT NULL , ...
3
votes
4answers
276 views

Keep track of time intensive stored procedure with prints

I am no database admin nor is my SQL-foo any good (yet), but have a few tasks to get done in MSSQL, and one is a rather time intensive procedure where I fetch from a CURSOR and WHILE @@FETCH_STATUS = ...
1
vote
1answer
41 views

MAX (id) function with MySQli

How can I use the following statement to return only the record with the maximum PersonID from the table? /* Create the prepared statement */ if ($stmt = $mysqli->prepare("SELECT Max(PersonID) AS ...
0
votes
1answer
68 views

how to select first 9 numbers from other table from database using sql query?

I want to fetch first 9 numbers from matching with other column please help me to find out thank you....? SELECT MAINFILE.facno,GLMAST.fglhead FROM MAINFILE INNER JOIN GLMAST ON ...
0
votes
0answers
38 views

Should I create a Factless Fact Table or Denormalise my table

I am creating a data warehouse from a store database and I have a question regarding the design of my dimensions and facts. In the store database a table exists for Person, Person_Address and ...