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

How to insert default values to a table with not null columns?

I have several tables with different number of columns, each can be either real or int, both not null (I can define them all real if required). I would like to write a query that inserts a row with ...
2
votes
6answers
86 views

Efficiently storing irregular/repeating intervals (think calendar/events)

I am developing a service that relies on users being able to recieve messages that they themselves choose. These messages need to be stored somewhere before they are send for processing. Right now ...
0
votes
1answer
38 views

Is there any way to get the estimate cost of executing a query in MySQL?

In PostgreSQL, EXPLAIN or EXPLAIN ANALYZE will show the estimate cost of executing a query. But EXPLAIN in MySQL doesn't provide this information. How can I get the estimate cost without installation ...
0
votes
1answer
38 views

Postgresql Database on external HD

I'm completely inexperienced with PostgreSQL, but have to do some work on it, and I have been googling for a solution for almost two days. I hope someone here can help me out. I have a PostgreSQL ...
0
votes
2answers
34 views

MySQL query optimization for legacy application

I'm working with a legacy application that started out with little data years ago (developed by a third party custom for this client), and now we're seeing MySQL load skyrocket on this query alone. ...
0
votes
1answer
20 views

Moving a heap between filegroups

I would like to move the tables in my database from one filegroup (Primary) to a another (a new one). I can find lots of advice on this concerning tables with clustered indexes but all these tables in ...
0
votes
0answers
28 views

Alphanumeric field in MySQL

I need to create a character field with some rules, they are, Field name: contract_number. Rules: Contract Number Contract number must be alphanumeric. Contract number must be unique. Contract ...
0
votes
0answers
13 views

How to Replicate data from read only sql database to Active one

We are applying logs in every 30 min to one SQL db which has to be in Restoration Mode/Read only mode as we are applying logs continuously. Now we have to Set up Replicaion of this Read only Db to ...
-3
votes
0answers
37 views

How to update top 10 rows in all Departments

i Have A 109 of Industry's and Date Wise JobPosts in job_post Table like Table: Job_post Field1: jobpost_id Field2: jobpost_date Field3: jobpost_Industry *How i Update Every Industry's top ...
1
vote
2answers
61 views

SQL Server hardware configuration: Best Practices [closed]

I inherited a relatively new database server that is light on hard drives. Currently, everything - OS, SQL Server, hosted databases, etc. - is running on a single partition in a two-drive RAID 1 ...
1
vote
1answer
40 views

How to connect client applications to SQL SERVER 2012 cluster?

Following are the environment Details : Database Server : SQL SERVER 2012 Operating System : Windows Server 2012 Single instance of SQL SERVER 2012 is installed in cluster configuration with 2 ...
1
vote
1answer
29 views

Resolving Cyclical Reference in Referential Relationships

I'm designing a small SQL Server Compact Edition database and am attempting to enforce referential integrity. The database is a simple backend for a small desktop application that functions as an ...
1
vote
0answers
15 views

ODBC Connection Not Refreshing

I am trying to connect FedEx Shipping Manager Integration Assistant to a SQL 2008 R2 database. I have a view created that has all the necessary fields to populate in the Integration Assistant. The ...
2
votes
1answer
40 views

Do SQL Server Views update their data types automatically based on what tables feed them?

Someone mistakenly created a bunch of nchar fields in database tables. I noticed this, and after examining the issue, we're moving these fields to nvarchar types and trimming the values inside. In my ...
0
votes
0answers
11 views

Cannot read property Collation.This property is not available on SQL Server 7.0. (Microsoft.SqlServer.Smo)

I am new to databases and Microsoft SQL. I just installed SSMS today and am getting this error while trying to add new login in security or rightclick-> view properties on user logins already there ...
0
votes
1answer
45 views

Add 0 into array_agg if there is no matching data

I wrote this view, and it is selecting almost everything I want, but I do not get results for all: project_keywords(which has_many project_report(keyword_id, project_id)) So a project_keyword has a ...
1
vote
1answer
45 views

Can't find stored procedure for updating after creating it

I'm trying to create a procedure to update my table create proc UPDATE_PRODUCT @ID_CAT INT, @ID_PRODUCT VARCHAR(30), @LABEL NVARCHAR(30), @QTE INT, @PRICE VARCHAR(50), @IMG IMAGE AS UPDATE ...
1
vote
1answer
50 views

Find the SQL query that caused an event in the past

I have a database in which I noticed that one of my tables is missing. I haven't used this database for over three months and now I want to find out who caused this, when this happened, how it ...
1
vote
1answer
39 views

Data History Table vs Using a Current Record Flag

There are two strategies when dealing with data records which contain multiple versions. One is to have current records in one table, and their past versions in a history table. The other is to have ...
1
vote
1answer
72 views

How to aggregate pairs of id values into groups

I have a table with two id columns id1 and id2. Each row shows that 2 id values have been linked together. My actual data has both id columns as varchar(20) but I have used integers in the example ...
1
vote
1answer
16 views

Make MySQL dump from parts of each table

I need to export some data from different tables. I tried this query select * into outfile 'C:\Users\\User\\Desktop\\ololo.sql' from db.users where id % 2 = 1; After this query, the SQL file was ...
0
votes
1answer
26 views

How to retrieve the Capture Instance for a given table?

Working with SQL Server 2012, I have a hierarchical table layout (TPT). All tables "inherit" from the same base table (dbo.DataObjects). All tables have history tracking via CDC enabled. I am trying ...
1
vote
1answer
60 views

Postgresql view how to do the query

I have 4 tables: Project: id name Keyword: id, name ProjectKeyword: project_id, keyword_id (project has many keywords, keywords has many projects) ProjectReport: project_id, keyword_id, ...
0
votes
1answer
35 views

date wise report and order by date

I have a table where I need to get this report format like this in datewise totals. I have 3 columns which are t_reference,t_pa_number,t_pa_name,t_date_time_issued from tickets table. date 17 ...
0
votes
1answer
40 views

Is not in (a,b,c) faster than where != a, b, c

When writing a query which is faster? SELECT * FROM table where column not in (a,b,c); or: SELECT * FROM table where column != a AND column != b AND column != c ;
2
votes
3answers
34 views

Steps after restoring to a different server

We have a 30 GB Database on SQL Server 2008 R2 Standard Edition. Yesterday we backed up the database and restored it to a different Virtual Machine which has exactly the same specs as the previous ...
0
votes
3answers
45 views

Can we restrict the number of connections to a database in SQL Server?

I have a database on SQL Server. My web application contacts this database. Is there a way in which I can restrict the number of connections to this database through some settings on the SQL Server?
0
votes
0answers
20 views

Database migrated to SQL Server 2005 with 80 compatibiltiy from SQL Server 2000 experiencing locks

I am supporting an application whose code my company did not write, and was originally developed back in 2000-2002, by a company that no longer exists. The code, while not great to maintain, ...
3
votes
2answers
138 views

Find which session is holding which temporary table

We have a SQL Server 2005 database the temp database has become full. By going into SQL Server Management Studio I can see all the temporary tables in the tempdb. Is it possible to tell which session ...
0
votes
1answer
36 views

Nightly reload of tables from a linked server

I have a number of tables that need to be reloaded nightly from a linked server. My current method of doing this is to create a nightly job to pull the data using something like the following: ...
0
votes
1answer
33 views

How to store chains of information?

I am currently trying to design a table structure that can capture report data (from various sources) in an ordered fashion. Let me give you an example: Each day I receive three separate reports ...
0
votes
0answers
22 views

Sql Server Standard VS Enterprise

I have been bench-marking SQL Server Enterprise and Standard, Enterprise is using Partitioning by month on the table. The table only has 3 fields, Date-time (DateTimeOffeset(3)), Value (integer in the ...
2
votes
1answer
57 views

Postgresql subquery speed much slower than individual queries

In Postgres 9.1. I am attempting to do a single query to get the timezone of a given postal code. I have data loaded in my database, and I am using PostGIS to store the coordinates of each postal ...
0
votes
0answers
12 views

Analyze a Database to Find Failed Foreign Key Constraints

I aggressively deleted a ton of data after using this query: SET FOREIGN_KEY_CHECKS = 0; Is there any easy way I can analyze the entire database to check to see if I have any hanging records that ...
3
votes
2answers
111 views

Enhance performance of update query

I have a query that is running against a table with 50 million rows. The phone number is stored as a CHAR(10) and an ETL process is changing the phone number if it has certain values. We are seeing ...
0
votes
1answer
33 views

How to query-and-increase a value (counter) in a thread-safe way? (avoid race conditions)

In a table where each row has a counter (just an integer value), I need to get the current value and increase it at the same time. Effectively, I want to do this: SELECT counter FROM table WHERE ...
1
vote
1answer
73 views

Take database backup of a SQL server 2012 from local SQL Server 2008 R2

I have a SQL Server 2012 installation that has some issues with SQL Server Agent because of which I cannot schedule a job or a maintenance plan to take backup. What I am trying to do is to create a ...
1
vote
2answers
74 views

Assign maximum memory limit for a particular database in sql server

In my SQL-Server instance, there are many databases. I want to restrict the memory size of each database (for example 8 GB). When I tried using Resource Governor, there are options like ...
3
votes
1answer
72 views

What does the “structured” in Structured Query Language mean?

What makes SQL "structured"? Are structured query languages distinguishable from unstructured ones? And when we say that SQL is "declarative", is that a related concept?
0
votes
1answer
71 views

Data Tier Application in SQL Server [closed]

Is it possible to transfer the modified data from sql server to data tier applications periodically because i have developed one DAC Package, Every week i have to give modifications on that week to ...
0
votes
1answer
25 views

how to acces the google sql database using python [closed]

They have gsutil for accessing google storage is there a similar tool for accessing google sql?
2
votes
2answers
71 views

Postgresql: Query across schemas

I have multiple schemas that I need to query across. The schemas are not know in advance for example: U111 U222 U333 I need to select across these three schemas from a specific table in each of ...
1
vote
0answers
37 views

1 SQL Instance on 1 box with multiple databases or multiple SQL instances on 1 box [closed]

I am a new DBA working for a charity and I have project to consolidate the multiple databases scattered across the organisation. I have identified the main databases that are mission critical to the ...
0
votes
0answers
16 views

using another table column as array

SET @qdate := '2014-02-17'; SELECT com.trading_code, com.business_segment_id, dmkt.close_price, dmkt.cdate, dmkt.turnover, dmkt.volume, sh.total_no_share, ...
0
votes
2answers
65 views

How to drop table with all reference to this table

I want to drop a table, and this table has be many table's foreign key. So I want to drop all those reference (just refernece, not other table) within the drop table process. Is there any simple ...
0
votes
0answers
24 views

Writing a Query to enter and update multiple data in a table [closed]

I am new to mysql and trying my best to learn. I was able to develop a solution for my needs but it is taking hours to update the records. till now only 10000 records are updated in past 3 days and ...
1
vote
1answer
45 views

Aliases with correlated subqueries

I am looking at an example of correlated subquery with aliases from a PostgreSQL book: bpsimple=# SELECT * FROM orderinfo o, bpsimple=# (SELECT * FROM customer c WHERE town = 'Bingham') c bpsimple=# ...
2
votes
1answer
30 views

Azure Database Size Same Before and After Deleting Most of the Rows

I have a database hosted on Azure which is showing as nearly full, it is at 1017MB/1024MB. The table contained around 27000 rows, I have deleted 20000 of those rows to try and free up space, however ...
0
votes
0answers
36 views

Conceptual data model for a billing system

I am working on existing MySQL database, my task is to create a new data model for a billing system on that existing application, I have created a conceptual data model, as given below, My ...
0
votes
1answer
80 views

How To Execute an Integration Services (SSIS) Package from a SQL Server Stored Procedure

i am executing query like this on sql server 2008 R2 DECLARE @returncode int EXEC @returncode = xp_cmdshell 'dtexec /f "C:\certs\SSIS Disposition\SSIS Disposition\SSIS Disposition\Package1.dtsx"' ...