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
1answer
458 views

can I Run a Stored Procedure across all SQL servers and return 1 html report

I have the following set up as a sp and it runs daily. It gives me a report for each SQL cluster in my environment but what I'd like to do is configure it to run across all clusters and return 1 ...
0
votes
1answer
2k views

How to grant permission for creating,reading and executing symmetric key in sql server 2008

We have user associated to a schema with limited privileges.During run time we are generating symmetric key using same user log-in.since the user has limited privilege, we are not able to create key ...
1
vote
1answer
112 views

Having trouble with a query. DBMS Assignment [closed]

Working on an assignment for school, was able to figure out all but this one. I need to display the employee name and employee identification number along with their HOD's name and identification ...
4
votes
1answer
1k views

SQL Server 2008 R2 Upgrade (Express to Standard) fails. No “Select Instance”

Hello there, i got stuck in the progress of upgrading 3 systems from SQL Server 2008 R2 Express Edition --> SQL Server 2008 R2 Standard Edition Problem: The Option "Select Instance" in the ...
2
votes
2answers
1k views

How can I change the number of @schedule_uid=N'????' to re-create a SQL Server Agent Job?

I have a SQL Server 2005 job in the SQL-Server Agent Jobs that I need to move/transfer to another updated SQL Server 2008 R2 instance. I was able to script it out and then use it as a new query window ...
-1
votes
2answers
2k views

Query to compare two rows in MySQL and make an UPDATE

I have a table (MySQL) like this: ID | AnotherID | Number1 | Number2 | Data 1 A 101 199 Lorem 2 A 102 ...
0
votes
1answer
314 views

Does the recovery model affect query speed?

Would using the Full Recovery model make something like a long running DELETE operation slower than it would be under the Simple Recovery model?
4
votes
2answers
94 views

StackExchange clone: where should I add my indexes?

I'm creating an open source stack exchange clone and the following is my schema. What should I add indexes on for it to be optimal? Here is the schema in Rails format (SQL format below as well): ...
3
votes
1answer
801 views

How to separate out individual sql statements from Oracle SQL script for execution from java code

I have Oracle DB 11g Enterprise Edition and I want to execute sql script from my java code. I am reading this sql script from a .sql file and the script contains statements such as create table, ...
2
votes
1answer
327 views

XML queries with case insensitive tag- which is the best query

I had asked question about XML queries with case insensitive tag earlier and i found a solution too. But i also found some other solution. So table was something like DECLARE @myTable TABLE ( yourXML ...
4
votes
4answers
128 views

Optimize MySQL Query using LEFT JOIN

I have a query with execution plan as below and is taking more than 20 seconds to execute how can i optimize it EXPLAIN SELECT c.coupon_id as c_id, `c` . *, `st`.`name` AS `store` FROM `coupon` AS ...
1
vote
1answer
402 views

Automatically schema backup in Oracle

I am working with an Oracle Database and I have a user (called XY) with permissions R/W. I would like to to do automatic backups of the user schema XY. I don't own the server and I don't know if the ...
5
votes
1answer
203 views

Why would SQL cast have to be expensive if used on a join column?

I see that sql join internally functions always on some of the three basic operations : nested loops join, merge join and hash join. From multiple articles on the internet I see SQL casting is said ...
0
votes
1answer
166 views

Keep rows only if Date exists in both table

This is my first time here, so please bear with me. Assuming i have 2 table, Table 1 Date | Closing 1/1/2013 | 1 2/1/2013 | 2 Table 2 Date | Closing 1/1/2013 | 3 3/1/2013 | 4 What sql statements ...
0
votes
0answers
4k views

How to fix error ORA-00322: log is not current copy

I have to submit my project a day after tomorrow. My project is ready but I am having above mentioned error while connecting to Oracle database. I tried the following solution: Enter user-name: sys ...
2
votes
1answer
2k views

Cassandra - Query a column with collection type

I am pretty new to cassandra, so pardon me if this turns out to be a silly question. I have a table structure as below CREATE TABLE data_points ( id text PRIMARY KEY, created_at timestamp, ...
2
votes
3answers
615 views

How to query efficiently from Postgres to select special words?

Let's say that I have a table called words with very many records. Columns are id and name. In the words table I have for example: 'systematic', 'سلام','gear','synthesis','mysterious', etc. NB: ...
0
votes
3answers
102 views

Applying data changes from one database to another

I have an application running on Oracle 9i database and I was looking for something more practical to deploy data changes (not schema changes) from the development database to production. Currently I ...
0
votes
1answer
57 views

Is having SQL Server express database on client better than querying data on a remote server? [closed]

I'm planning to create a SQL Server Express database on each client machine that will sync with the remote server's data. What I'm trying to achieve is to have a faster processing and querying of data ...
0
votes
0answers
31 views

SQL Server Problems [closed]

I have recently installed SQL Server 2012. I have the Management Studio and the configuration manager. When I open the Management Studio, I have no object to connect to though. I have no SQLExpress to ...
4
votes
2answers
3k views

What is the meaning of tinyint(N)?

When we use an argument length with numerical data types, as far as I know this specifies the display width. I tried the following: mysql> create table boolean_test (var1 boolean, var2 tinyint); ...
1
vote
1answer
101 views

numbering rows consecutively for a number of tables

I have a number of tables, all containing attributes aid,bid,cid, and xid of type integer, other attributes may differ. For every (given) table T, I would like to order the rows according to ...
3
votes
0answers
51 views

How do i Optimize/Improve ram while running a massive import into sql server [duplicate]

I currently am importing a massive database of around 180 million records with roughly 300+ columns. I am sure you are all aware this takes a very long time. I am using sql server on a windows server ...
12
votes
4answers
9k views

Why use WHERE 1 or WHERE 1=1?

Usually, if conditions are not required in our query statements, we don't use a WHERE clause. But I see a WHERE 1 clause being used in many places, even where other conditions are not present. Why ...
0
votes
1answer
162 views

MySQL: fetch multiple global status and system variable in a single query

When we execute SHOW global status; or SHOW variables; we get list of 291 and 278 records in the resultset. For performance perspective, only few of them are much important. I have to fetch these ...
1
vote
2answers
73 views

Recommended best practice for server naming [closed]

We're currently in the process of upgrading to SQL Server 2012, in the past all servers have been installed with a naming convention which contains a "-" in the middle i.e. TS-DBL01 I'm trying to ...
0
votes
3answers
69 views

Get records which doesn't have duplicate records

I have a table with polcies and class codes, I want to get all policies which doesn't have duplicate class codes. Do you have any idea? One policy may have one or more class codes. If any class code ...
2
votes
1answer
44 views

DB2 MQT not rewriting role playing columns

If in a MQT, if I have 2 referential constraints to the same table (role playing) , usage of one of the constraints doesnt allow the query to be optimized Example FACT_SALES DIM_BILL_TO_ID --> ...
1
vote
2answers
157 views

How can I run this SQL query across all of my databases at once?

I have a query to let me know basic info on backups. I have several SQL servers that I'd like to be able to query at once. Is it possible to run the following query across several servers at one time? ...
0
votes
0answers
137 views

Making cloned copies of a innoDB mySQL database

I'm trying to find a better way to clone innodb mysql database then using regular import. We use an innoDB mySQL database in production. A backup is created daily from production. Currently each ...
0
votes
1answer
527 views

Get max date for each year from list of dates

Need to get max date for each year from list of arbitrary dates: date year ================= 1/10/2013 2013 3/26/2013 2013 4/20/2012 2012 9/10/2012 2012 5/6/2011 2011 So ...
0
votes
0answers
59 views

“Show table data” option to edit compact database

I have installed sql server compact edition 3.5 and i am sql server management studio to edit table.I am using "Show table data" option which comes on right click to a table of compact database. But i ...
0
votes
2answers
54 views

How to set up where to store data in SQL Server

My C:\ drive has a size of 99GB and my D:\ drive has a size of 2TB Here comes the problem: where does SQL Server store data in the database? Can I control it? Actually, my C:\ has been full of data ...
0
votes
0answers
96 views

Error adding constraint foreign key to bridge table

Hi there I am fairly new to sql development. I am current following the head first into mysql book and is on chapter 6. On chapter 6 there is a table in third normal form but it does not contains the ...
2
votes
0answers
653 views

Microsoft Sql Server 2012. 100 000 000 rows table select/insert performance [closed]

This is first time i am working with huge database ( 100 million rows in table Events). Use case here is to quickly select and insert x and y for selected Organisation and datetime. My database ...
1
vote
1answer
197 views

Slow queries related to subqueries using aggregation

Here's a simplified version of the queries I am running: select ... from editions join edition_events on edition_events.edition_id = editions.id join events on events.id = ...
0
votes
0answers
52 views

Have non clustered index but no clustered index [closed]

If a table have two columns say (say Id and Name) has only non clustered index on name column but no clustered index, then what happens to performance of the table ?
2
votes
1answer
139 views

Query Previous Records (Oracle)

Consider an Oracle database that has a person, a date and a value in every record. When I pull a record, I want to very quickly and easily get the previous record where person is the same in both the ...
8
votes
1answer
1k views

SQL Server's READ COMMITTED SNAPSHOT vs SNAPSHOT

I was researching the differences between SQL Server's READ COMMITTED SNAPSHOT and SNAPSHOT isolation levels and came across the following resource: Choosing Row Versioning-based Isolation Levels ...
1
vote
1answer
60 views

query errors when all data not present

I have a working query that show success rate of staff. When I run it in for all staff it works flawlessly. However, when I insert it as a function within a java based page I get an error: ERROR: ...
0
votes
1answer
102 views

Trying to count multiple values and total

SELECT COUNT (DISTINCT competition.genre_id) genrecount, COUNT(DISCTINCT band.band_id), genre.name, genre.genre_id FROM genre, competition_band, competition, band WHERE genre.genre_id = ...
5
votes
1answer
767 views

How to migrate between schemas in bulk in SQL Server?

We currently have multiple databases but would like to combine them and, instead, separate our domain contexts using schemas. In MS SQL Server 2008 R2, how can I relocate all the contents of one ...
0
votes
1answer
64 views

How to add up a column depending on data from another column

I have a table which has results and a table that has band_name and band_id. Now I need to create a query which will add up the total points for each band and display the band name and ID, so far I ...
1
vote
1answer
54 views

Why did my indexes drop in size?

I've got the following SP which I wrote to calculate the size of all the tables on my database SELECT name,dbo.nice(rows) as [rows], dbo.nice(CAST(total-indexes as DECIMAL)/1024) as [data ...
0
votes
0answers
597 views

How to determine if SQL Server Reporting Services database is being used?

I have a SQL 2005 server that needs to be decommissioned. For regular databases, I have a couple scripts that look at sys.dm_db_index_usage_stats to determine last access. My normal process is to make ...
0
votes
1answer
129 views

sort a large table by its primary key and save it back

So I have a large table (>50 million rows) with an auto incremented primary key column, which is filled by a script running on multiple cores. Now, when I do a SELECT, entries are returned 'out of ...
0
votes
1answer
46 views

Suggest performance tradeoffs

I have a an inner query that needs outer query column values as input. It looks something like this CREATE TABLE TISSET( COL1 int ,COL2 int,COL3 int) INSERT INTO TISSET VALUES (1,1,1); INSERT ...
0
votes
2answers
457 views

Warning before issuing delete/update command in mysql/oracle , then executes

Is there any utility , function either in mysql /oracle that if i issue some delete/update command wrongly , a message must prompt at command_line* (if possible in ubuntu) asking whether "you sure to ...
1
vote
2answers
413 views

MySQL query log

I wonder if there is an alternative for MySQL general query log. I would like to log (mostly) DDL statements, so I could trace what user DROP database/table etc. I know that enabling general query log ...
1
vote
1answer
2k views

Is it possible to query value of SQLNET.EXPIRE_TIME parameter?

Can somebody advice whether it is possible to query for current value of SQLNET.EXPIRE_TIME parameter in Oracle 11 DB? Should select * from v$parameter return value of SQLNET.EXPIRE_TIME (if it ...