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
45 views

Where can I get best resources to learn sql? [duplicate]

I am very new to the databases just have basic knowledge about it. I want to learn sql language and dont know where to start. Please help me to start with it. And what is the difference between ...
2
votes
1answer
42 views

redundant foreign keys in PostgreSQL - are there any indexing benefits?

Note: this is not the same as this SO question which is about adding redundant information in the tables themselves. Does the final statement in the below series of statements buy me anything in ...
0
votes
2answers
127 views

What is the performance difference between IN (42) and id = 42 in MySQL?

Are there any performance differences between SELECT * FROM table WHERE id IN (42); and SELECT * FROM table WHERE id = 42; ? The question is about just supplying a single value. The ...
0
votes
0answers
38 views

Master Slave Databases and their architecture

We are currently using Sql Server 2005. We currently have separate databases for different instances of our application. The application is a heavy in terms of data and processing. We now want to ...
0
votes
1answer
100 views

ORA-30009: Not enough memory for CONNECT BY operation

I have a Linux VM (with CentOS 64 bit) where I installed Oracle Database 11g Express Edition. The database is running, I can use sqlplus and I can create tables and stuff. However, when I run a ...
2
votes
1answer
364 views

Converting XML to SQL tables

I have a large XML file in the following format and I need to convert this file into a MySQL table. Please let me know how can I accomplish this? ~~~~~~~~~~ <host starttime="1392325468" ...
20
votes
2answers
856 views

Why does query error with empty result set in SQL Server 2012?

When running the following queries in MS SQL Server 2012 the second query fails but not the first. Also, when run without the where clauses both queries will fail. I am at a loss why either would fail ...
0
votes
0answers
9 views

Do link servers cache remote database connections?

I have set up a link server from a database server (SQL2008) to my local SQLEXPRESS db, using the actual database as its Failover Partner. I then stopped the SQLEXPRESS service and I could still ...
2
votes
1answer
74 views

How to allow connections to SQL Server with 2 differents ip

I have a small issue here: I have a SQL Server instance 2012 (let's call it INSTANCE) on a cluster. I also have 2 network interfaces for this instance: SQLINSTANCE.my.metwork ...
-1
votes
2answers
99 views

How to Create users in sql server for accessing only one database using Management Studio [closed]

How to Create users in sql server 2008 R2 for accessing only one database using Management Studio. regards, salman
0
votes
3answers
116 views

How to IFNULL or COALESCE rewrite in a SQL query?

I there a way to rewrite a SQL query, so I can avoid IFNULL or COALESCE, because the HXTT DBF JDBC driver (supports SQL92) throws the following error.: Caused by: java.sql.SQLException: The aggregate ...
1
vote
1answer
48 views

Oracle - Date of Selection on table

how to get last date when someone perform selection on table? Last accessed in terms of select statement only not last updated date
0
votes
2answers
41 views

Do I need to have enterprise server in order to have multiple data sources in SSRS

I am currently running a single server setup of SSRS on MSSQL Server 2008 R2 Standard Edition and would like to know if I can have multiple data sources in this type of setup. The reason I ask this ...
0
votes
1answer
61 views

DB2 - Not enough storage in the database heap error when trying to create database

So like the title says I'm trying to create a database using this script db2 -v -t "CREATE DATABASE %DBNAME% ON '%DBDRIVE%' USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM CATALOG TABLESPACE ...
0
votes
2answers
44 views

mysql select query to select from single table with multiple WHERE clauses

i am new to database querying so apologies for this rudimentary query question. thank you in advance. table called "neuron" columns in "neuron" called "neuron_id", "neuron_name" + others (not ...
0
votes
1answer
65 views

Nested query not recognize external table

i need to a query that show week by week the total amount of imports of any company and in addition add a ranking position depending on that amount. I've made this query but the problem is the inner ...
1
vote
0answers
113 views

Postgres database zero down time production deployment

I need some idea about how I can deploy a financial application in production environment using PostgreSQL DB with zero down time. I have two servers in Master-Slave design. Currently I am giving ...
0
votes
2answers
96 views

Join two subquery in hql

How can I write this sql query in as hql: select count(distinct s.id) as prepaid, count(distinct ss.id) as postpaid from (select * from subscriber where subscriber.ispostpaid=0) s join (select * ...
1
vote
4answers
85 views

Backup from Server1 and restore it to Server2?

IF we have two Servers installed with SQL Server 2008 instances, Server1 has three drives C, D and E with 100, 500 and 500 GB respectively and Server2 has three drives C, D and E with 100, 300 and ...
1
vote
0answers
37 views

Find repeating tickets with more than one criteria

Lets say I have 2 tables: atms & tickets each atm has many tickets. ATM table: ID | NAME ------------------------- A0109 | ATM 1 A0227 | ATM 2 etc. | etc. Ticket table: ID | ATM | ...
0
votes
2answers
155 views

Finding all sql id, sql text, number of executions,execution time between two AWR snap ids in oracle

AWR report provide the SQL information for top 10-20 SQLs, is it possible to get information on SQLs that do not make it to the top list. How do we find all sql id, sql text, number of ...
0
votes
0answers
50 views

Based on these DBCC SHOWCONTIG stats, should I index this table?

I have a SQL 2008 Standard server on full mirror (safety). I reorganize all indexes weekly. I am looking into rebuilding a few indexes to improve performance. I ran DBCC SHOWCONTIG on my largest, most ...
0
votes
1answer
87 views

SQL Query: Join Tables using two partial string matches

Using MS Access, I have to combine two tables where two criteria must be met: Container = Container AND Booking = Booking. I have two tables where fields are missing a value: Table1 and Table2 have ...
0
votes
1answer
84 views

Subtract values from SELECT in SQL

I have the following 2 queries.: shipManagementInvoiceNetValue: SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE ...
0
votes
1answer
107 views

create a batch script on windows that periodically starts a sql function

I need to create a batch script on windows that periodically starts a sql function written in 'plpgsql'. I can use windows schedule task for creating a cron job but I don't know how to write the ...
1
vote
1answer
62 views

Return value formatted similar to if casted as money

My client's system is very outdated, and there is nothing I can do about it. What I'm trying to achieve is to extract values always with at least 2 decimal places. E.g. From 1826.5695600000 ...
0
votes
1answer
63 views

Issues restoring db [closed]

So I had initially received the 'database in use' error, searched for a solution on Google, was led to believe that I might need to change the default db account connects to, changed it and am still ...
1
vote
1answer
34 views

Case when missing line logic

I have a case when statement in a extract query which doesn't seem to be returning what i'm expecting DECLARE @Val1 int, @Val2 int,@Val3 int, @Val4 int, @Val5 int SELECT @Val1 = 5 , @Val2= 2,@Val3= ...
0
votes
0answers
25 views

Mysql View Performance on Aggregate Functions

I've a table that contains weekly statistical infos. ex. Society - Week - Year - Data AAA Inc - 1 - 2014 - 10250 AAA Inc - 2 - 2014 - 5235 BBB Inc - 2 - 2014 - 3210 ... Over this table i need to ...
-1
votes
1answer
116 views

How to set up a connection in Pentaho Kettle for Oracle using a SERVICE NAME instead of SID?

This error shows up when I try to connect to database string host:port/servicename.
0
votes
2answers
168 views

exporting oracle tables on command line as sql files

I use exp and expdp to export database tables on command line but it generates binary .dmp files. I want to export/import tables as .sql* files on command line like pl/sql developer app can do. Is ...
6
votes
2answers
170 views

Should I nest dependent outer joins in SQL Server?

I have heard mixed information on this and am hoping for a canonical or expert opinion. If I have multiple LEFT OUTER JOINs , each dependent on the last, is it better to nest them? For a contrived ...
1
vote
1answer
45 views

CDC not picking up changes [closed]

CDC has been set up for one of our databases in our test environment but it's not capturing any of the changes. I've made sure the capture job is running. I've disabled CDCs for the database, enabled ...
2
votes
1answer
57 views

Result of a query in SQL

Let us say that we have to write a query for: Find the distinct names of all students with percent>90 in courseno=107 given three relations: Students (rolno:integer,sname:string) Courses ...
1
vote
1answer
47 views

Designing database with Category and Tags for Posts - Seeking for guidance/advice

I'm not really a database novice but I'm not an expert either. Problem: I'm having this difficulty on designing my Post, Category and Tags relationship. I've read Normalization many times but could ...
0
votes
1answer
24 views

Postgres recovery.conf options

I am setting up Postgres binary replication. In my slave's recovery.conf, I am suggested to have 2 options. I am wondering if the directory specified in restore_command and archive_cleanup_commands ...
0
votes
2answers
51 views

Disk write in iotop when doing mysql “Copy to tmp table”

I have just moved servers from a two-server configuration with the application and database server running separately to a one-server LAMP stack. Unfortunately the issue that I have encountered on ...
0
votes
0answers
17 views

Advice on designing databases for things like Posts and categories; and general rule of thumbs

I'm creating my own website with a capability to CRUD posts and other related stuff like category, tags and other things (I believe it's similar to the first two mentioned). Posts: (current create ...
2
votes
1answer
189 views

MySQL failing and very slow on importing a large file

I have a 47 GB MySQL dump of a single table: http://dumps.wikimedia.org/commonswiki/latest/commonswiki-latest-image.sql.gz I ultimately want it into PostgreSQL, but since I didn't figure out an easy ...
2
votes
1answer
89 views

How can I use running total aggregates in a query to output financial accumulations?

I am attempting to write a query that will be consumed by a SSRS 2012 report. Given a paid invoice, with a certain set of account allocations towards which the money paid towards it must be saved, I ...
0
votes
0answers
44 views

Linked Server for MultiSubnet AG Listener

How do I create a linked server for an AG Listener that is in a multi-subnet configuration? I have a couple clusters that need to be able to query the listener at hand but the node that is on the ...
7
votes
3answers
474 views

SQL Calculated Field in both SELECT and GROUP BY clause

Often in querying my MS SQL Server databases, I need to create a calculated field, such as this (CASE WHEN A.type = 'Workover' THEN 'Workover' ELSE (CASE WHEN substring(C.category, 2, 1) = 'D' ...
0
votes
1answer
84 views

Partition tables based on month and year in SQL Server

I have a sales table which I need to partition based on month and year of sales table structure S_ID numeric(18,0) S_CustID numeric(18,0) S_TotalCash numeric(18,0) S_Paid ...
1
vote
1answer
51 views

Is it possible to restrict SQL Server DB_Owner when connecting using SQL Server Mgt Studio? [duplicate]

Here is the back story. A developer created an EXE program. The exe program has the ability to access a SQL Servre database. In order to do that we create an Active Directory group. Let's call this ...
2
votes
0answers
66 views

Use Matlab or SQL Server to do mathematical computations? [closed]

Current situtation I am working with a dozen of CSV files containing financial simulations in form of 100'000x100 matrices. Each file is around 100Mb large. Until now, only analyse these files with ...
0
votes
0answers
39 views

Multiple update of records in the same table

I have an update query. E.g. UPDATE table SET name = ? WHERE id = ? Now I have all the relevant ids collected. What I am doing is looping over the ids and execute the update query for each one. E.g ...
1
vote
0answers
35 views

DB2 LUW Query Optimization - IXSCAN timerons greater than total timerons

Sorry - I feel like this is a newb question, but I can't find anything on it. In optimizing a query, I was able to apparently reduce the total timerons from 3,700 to 38. However, on closer examination ...
1
vote
2answers
86 views

SQL Update column with data from another table

I am working on complicated problem, but I will simplify it to this problem. I have two tables A [ID, column1, column2, column3] B [ID, column1, column2, column3, column4] and i want to update ...
4
votes
2answers
682 views

if-then-else gives a boolean headache

I have three statements to combine but I cannot find the correct solution for SQL Server 2008 R2: I need to concatenate three columns into one but in three different ways depending on the result in ...
3
votes
1answer
103 views

sql server service broker queue pass parameter to stored procedure

Stored Procedure Create PROCEDURE [dbo].[InitServiceLog] ( @name varchar(max)=null ) AS BEGIN SET NOCOUNT ON; insert into [AdventureWorks].[dbo].[ServiceBroker_Log](Service) ...