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)

0
votes
1answer
12 views

Is inserting multiple queries takes same time as that of single query?

I have a requirement where I have to insert a lots of rows.For inserting we use like this insert into emp(name,age) values('abc',12); This will insert only one row.For inserting multiple rows we ...
0
votes
0answers
12 views

Update a set of SQL statements

dbo.MatchFirstName(@FirstName) and dbo.MatchLastName(@LastName) are table Value Functions(TVFs). Problem: In my Update statement i.e Update #Temp after Insert, I want only those rows to be ...
0
votes
1answer
28 views

Query on 250 million records

I have a table with below structure CREATE TABLE [dbo].[ColumnValues]( [Id] [int] IDENTITY(1,1) NOT NULL, [ColumnId] [int] NOT NULL, [Value] [nvarchar](max) NULL, [OutputArea] ...
0
votes
2answers
21 views

SQL Server tuning: Disk queue to OS drive: How to optimize?

I expect to see the disk queue move on the data, tempdb, log and backup volumes. I do not expect to see the OS drive (C:) which has zero SQL files present, show disk queue impact. Assume it is to ...
0
votes
1answer
29 views

Exclusive access to edit rows

I'm developing a program that allows users to view and edit data. My question: Is there tools (sql server tools, may be users/roles) to implement the following: There are two users: A and B. User A ...
0
votes
1answer
35 views

Uexpected values inserted in table

I have a table called FunctionWeights which contains data as follows: My query is as follows: select @constVal = FunctionWeight from dbo.FunctionWeights where FunctionWeights.FunctionName = ...
0
votes
1answer
23 views

Update does not working while select returns right results

I am trying to execute the query below: UPDATE( SELECT Ord.Completed FROM Product P INNER JOIN Order1 Ord ON Ord.OrderID = P.OrderID WHERE EXISTS( SELECT * FROM Delivery ...
0
votes
1answer
19 views

Converting sql into mongodb nosql

I am trying to convert oracle sql into its mongodb equivalent version. create table my_hll as select mod(ora_hash(n), 1024) bucket, max(num_zeroes(trunc(ora_hash(n)/1024)))+1 val from previous_data ...
-2
votes
0answers
11 views

which one is better for connecting vb.net to sql? wizard or ado.net coding? [on hold]

What is the solution for this picture? Data is not saving in SQL database. I think it happend when i added the grid-view.
0
votes
0answers
14 views

Difficulty with nested query order & grouping

I'm trying to identify the count of objects a user updated during a given day, but only where the user was the final update. Each object can have multiple updates in a day from any user, but the ...
0
votes
0answers
19 views

How can I track changes across 60 local databases with 1 million+ rows each?

The files are mdb and I have them locally on my computer. Just trying to track changes across the 60 databases. Realistically I want to compare two at a time and find the differences in the reports, ...
2
votes
1answer
16 views

How to pass multi-valued characters in SSRS Report?

I have a SSRS report that has 3 data sets feeding off one data source. The main dataset is a stored procedure that is aggregating some data based on a set of parameters powered by the other two ...
0
votes
1answer
28 views

locking the database to a single user so that other user wont change it

I am using SQL CE 4.0. In office the database(.sdf) file are in server. When I want to change design of the database I have to copy it to local PC and access it since n/w connection to a compact ...
-2
votes
0answers
30 views

Multiply operation/field causing the record set to 'ungroup'?

I'm trying to sort a query for a report but every time I add a Multiply operation to it the record set result becomes a mess and if I try to GROUP BY I get the legendary ...either an aggregate ...
0
votes
2answers
27 views

Oracle custom week of the year numbering based on first Monday of the year

I have following sql for generating dates, I wanted to change week of the year numbering based on 'First Monday of the Year'. Hence numbering would be, 01-05-15 ---> 01 01-12-15 ---> 02 ...
-2
votes
0answers
27 views

SQL job to backup and restore database [on hold]

I need to create an MSSQL job that would run nightly and bakup a database and restore the database with a different name. Example NorthDB (Original Database), NorthDB_test (backup database restored). ...
0
votes
0answers
21 views

How to cast as type of a table column?

I have multiple views with union like this: select column1, column2 from mytable union select cast(extcol as nvarchar2(15)), cast(extcol2 as nvarchar2(10)) from exttable But later I change the size ...
0
votes
0answers
28 views

Can I manage NULL = 'SomeDefault' in the database so applications and SQL don't have to remember this optimization?

I have a table with lots of default values, and want to store very common values as NULL to save space, without forcing my SQL statements or application logic to become overburdened with conditionals. ...
0
votes
1answer
31 views

Long running query…only on replicated database

I have an issue I can't seem to solve and wondering if anything jumps out at you. I have a query that I got from one of our developers, it runs in about 5 seconds on our production database and also ...
0
votes
1answer
23 views

Improving lots of Left Joins ( SQL Server 2008 - procedure )

This query is running with 8 minutes to complete. I'm trying to help the programmer with this task. I've created indexes and stats, update_stats and rebuild indexes but none of this is helping us. ...
1
vote
0answers
11 views

Simplifying UNION query that looks for duplicate names

create table sections( id serial, section_name char(255) not null, version_id int not null ); create table section_versions( id int primary key not null, version_name char(255) not null ); ...
1
vote
1answer
57 views

Get all rows in table A even if no rows in table B in CROSS JOIN

I Have This query SELECT * FROM ( ( SELECT SUM(Auditoria.Importe - ISNULL(Auditoria.Pago, 0)) AS Deuda FROM Auditoria INNER JOIN Articulos_Auditoria ON ...
1
vote
1answer
22 views

HTML entity decoding with oracle DBMS_XMLGEN.convert

Here, I am trying to convert the value, where I don't understand I am going wrong. Your help is highly appreciated! Here I am#44; THis is me there#39;s nowhere else on earth I rather be Here I am#44; ...
1
vote
1answer
41 views

DataBase Back Up - with a Not Null Column [on hold]

Can I include a default value to be entered in the Not Null columns when I do database back ups ? If so How can I do that?
0
votes
0answers
20 views

How can I use Oracle's CONNECT BY PRIOR to only get specific revisions of hierarchical records?

I've got a table schema in Oracle 11 which is storing records that are linked together. The table schema is roughly like this CREATE TABLE "SOMEDATA" ( "ID" INTEGER NOT NULL, "ITEMNAME" ...
0
votes
1answer
14 views

How to modify the below script to take tables and its sizes for a particular databse to send via mail to a recipient?

SELECT top 10 t.NAME AS TableName, (SUM(a.total_pages) * 8)/1024.0/1024.0 AS TotalSpaceGB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN ...
-4
votes
0answers
29 views

Getting count on multiple fields from table [on hold]

Please take a look at this page Travelmob. As you keep filtering on the "Amenities" or "Experience" on the left side, it update the total count on all of the fields. How do they do that? (could it ...
0
votes
0answers
7 views

Replication from Database A to Database B without taking new snapshot

I have Database A which is my publication database. Database B was a subscriber but something went wrong and we need to re-do the transactoinal replication. Database A is over 200GB and takes a ...
2
votes
0answers
19 views

Update matching keywords from first table to second table in SQL

I have two tables where 1st table is Englishgermankwds_tbl and 2nd is Kwd_UploadRecored the data of the tables is as follows Table Englishgermankwds_tbl English_Keywords ...
0
votes
1answer
36 views

Getting around the constraint “column must appear in the GROUP BY clause or be used in an aggregate function”

I'm using Postgres, which enforces the constraint that all columns in a SELECT...GROUP BY must appear in the GROUP BY clause or be used in an aggregate function. Lets say I'm modelling peoples' cars, ...
0
votes
1answer
24 views

NOT IN statement or what to use in this case?

I need to delete each row in fabricante_producto_solicitud (fps from now on) table if fps.id has not relation (NOT IN) fabricante_modelo_marca_producto (fmmp from now on). Since my input will be an ...
0
votes
1answer
16 views

wild card for entry id mysql

So I have a blog and some of my entries are set to "members", but I want to set them to "everyone". I originally thought it was only a few entries and so I thought to change them manually using ...
0
votes
0answers
12 views

Database design for varying prices from multiple vendors

I am designing a database where the products are sold in bulk with multiple pricing options, from 4 different vendors. What is the best table configuration to store this information? Id like to be ...
0
votes
1answer
7 views

Exported CSV from MySQL doesn't appear in specified directory

I'm trying to figure out the syntax to export the results of a MySQL query to the desktop as a CSV file via SSH. Here's what I'm trying: SELECT * INTO OUTFILE 'C:\Users\Jim Smith\Desktop\zyzyz.csv' ...
0
votes
0answers
30 views

MySQL Dynamic columns duplicate value workaround

As the title suggests i have the following code which transposes certain row values into field names, however the problem im having is that the values "closed" & "reopened" may appear in several ...
1
vote
2answers
40 views

Efficient query to get last row group by multiple columns

I have a table like the following: spread_id serial NOT NULL, game_id integer NOT NULL, sportsbook_id integer NOT NULL, spread_type integer NOT NULL, spread_duration integer NOT NULL, home_line ...
1
vote
0answers
10 views

Error when creating Trigger (PostgreSQL 9.4)

I created a table 'Company', and I want to create a trigger so a company can only present in one city, but it can be present in several different cities in the same country. For example, there's only ...
0
votes
0answers
22 views

Auditing SQL Server 2012 [on hold]

I work for the State of California. I am working on a project setting up a Data Warehouse sharing data between 3 state agencies. The Data Warehouse will be encrypted. I would like to know what are the ...
0
votes
0answers
21 views

How to shard a database like SO? [on hold]

I know a bit about sharding but I cannot wrap my head around that fact that say eventually SO cannot scale vertically then how would they shard their SQL DB? Even if we assume SO will not reach that ...
1
vote
1answer
31 views

How to shard a database like that of SO?

I know a bit about sharding but I cannot wrap my head around that fact that say eventually SO cannot scale vertically then how would they shard their SQL DB? Even if we assume SO will not reach that ...
0
votes
0answers
51 views

sql join without combining all rows

I've searched questions but can't seem to apply to my scenario. Please see attached code below. I am trying to join two subsets of this data but am getting duplicates/too many rows please see ...
0
votes
2answers
59 views

How to insert or update using single query?

I have a table test having columns id which primary key and auto incremented and name. I want to insert a new record if annd only if there are no records.For example input is id=30122 and name =john ...
0
votes
0answers
7 views

Database systems with users and sub users accessing the data

I am making a database for school student maintenance. Below is the basic description. There are schools. One school has many staff (i.e: Principles,Teachers, Section Head, Office Staff etc) These ...
1
vote
2answers
92 views

SQL Server - Slow Database for no apparent reason [on hold]

I have a DB Server running SQL Server 2008 R2 SP2 on 24 physical Cores and 32GB of RAM. The database files are on a SSD Raid1 and the TempDB on a SAS 15k (150GB DB) I assume that the server has more ...
0
votes
1answer
45 views

Transpose MySQL rows as column names - DYNAMIC

My goal is to be able to calculate the time difference between the ticket timestamp being created and closed and if reopened Add time from being reopened to closed again etc.. I have an existing mySQL ...
0
votes
1answer
61 views

how to convert inner join to where clause [on hold]

I have a sql query to retrieve a data from a complex database. Following is the sql query, select * from A a inner join B b on a.a_id = b.a_id inner join C c on c.b_id = b.b_.id inner ...
0
votes
1answer
21 views

how to query multiple counts on related tables

For each Forum, there are many Posts, and for each Post, there are many Comments I'm trying to query the total number of Posts and Comments for each Forum So I'm looking to have an output as such: ...
0
votes
1answer
30 views

how to get child categorys based on categoryid

this is my table structure i need to find child categoryids. If CategoryID 1 then 1,2,3,4,10,12,13,14,15,16 when CategoryID 2 then 2,10,12,13,14,15,16
1
vote
1answer
48 views

Join conditions and Where conditions in Left Join

STUDENT table contains a list of students in my school Database LIBRARY_BOOK table contains the information of each Book that is with currently with any student. each student is allowed only 1 book ...
0
votes
0answers
22 views

Designing a correct table structure

We are trying to save the Family History of a particular foreign job applicant. Below are the details we have to save. Familiy Member: Father|Mother|1st Brother| 2nd Brother| 1st Sister| etc etc ...