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
2answers
31 views

Tsql Query speed slow due to Or within where clause, causing index scan instead of seek

I have been working on making this query work more efficiently. I found that the number of Ors within the where clause are the biggest problem within this query. This query sits in a stored ...
-1
votes
1answer
18 views

How do I select data with a case statement and group by?

I'm trying to manipulate data a little by using a case statement but can't seem to figure it out. Stops -------------------- 1Stop 1-Stop 1 stop 1 Stop 1stop 1 Stop 2-Stop Im trying to come up ...
1
vote
2answers
244 views

Storing a Shipping Address Best Practice

I'm building a checkout system which needs to store the customer's shipping address in the database and am unsure the best way to go about it. Currently I have an addresses table which stores each ...
0
votes
0answers
14 views

How to find non utf8 data in mysql

Ok so I have a mysql database containing data that is input from various customers. The customers are told that their data should only be encoded as utf8 however I have become aware that this is ...
1
vote
2answers
7k views

Oracle password has expired, however I have no way of changing it

When I connect to my local development database, I get an error saying the password has expired. I've been trying to change it with sqlplus to no avail: C:\>sqlplus ...
2
votes
1answer
2k 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"' ...
0
votes
1answer
101 views

How to optimize query

using SQLite3 and the following query, it seems like there should be a better performing way to write this query? Is there? Select Name, Sum(Case When Used Is ...
1
vote
0answers
36 views

DB Design: Looking for Performance improvement with a Column used in all SQL Queries

I recently got added to a new ASP .NET Project(A web application) .There were recent performance issues with the application, and I am in a team with their current task to Optimize some slow running ...
1
vote
1answer
126 views

Mysql down on my server (log files)

I have server (on DigitalOcean) with LAMP + site with wordpress 3.8.1. Sometimes my MySQL server down. I try to plug swap, and it helped sometime (fo example when pst publishing) but sometime my site ...
1
vote
1answer
110 views

Database Mirroring and Replication in SQL Server 2008 R2

I have configured the mirroring and replication between 4 servers (A,B,C,D).i.e, Mirroring between A to B and C to D, Replication between A and C. The configuration was a success and I am able test ...
0
votes
2answers
38 views

Calculating average with AVG for a list of numbers

This is probably a newbie question (bear with me) but how can I calculate the average for a list of numbers using SQL and the AVG function? I mean, I can add together numbers in SQL like: SELECT ...
0
votes
0answers
3 views

Set method to change StartMode property using SqlServer.Management.Smo.Wmi.Service

I'm trying to change SQL server Configuration manager settings using Microsoft.SqlServer.Management.Smo.Wmi.Service. Microsoft provided with a list of methods & properties here. I used the ...
0
votes
1answer
28 views

SELECT count vs DELETE JOIN. Why/how are they different?

Can someone explain in what way these queries could be different and the results are not the same? > begin; Query OK, 0 rows affected (0.01 sec) >select count(*) from tableA a JOIN tableB ...
1
vote
2answers
59 views

PostGIS vs. SQL Server for GIS data

So I'm recently starting at a new company and have a lot of ArcGIS users who seem really keen on going forwards with a PostGIS instance to serve some data to our customers. While I don't have an issue ...
0
votes
0answers
34 views

Emulate regex matching in ANSI SQL

I'm working in an ANSI SQL environment (no regex) on a script that is supposed to take the first 8-10 consecutive digits out of a text field that could: have alphanumeric characters, and some other ...
0
votes
1answer
51 views

Why isn't this index helping my InnoDB MySQL query?

I'm having trouble understanding why an index I have on one of my tables is doing nothing to help the performance of a JOIN, even when forcing the index. Here is the query: EXPLAIN SELECT * FROM ...
0
votes
0answers
35 views

Is it possible to learn (and make a career out of) SQL without official training? [on hold]

I'm really interested in learning SQL (SQL server or Oracle) as I already have a bit of experience with the databases at work (mostly select statements). I don't have a technical background since I ...
0
votes
2answers
61 views

Group by + Order by Behavior Explanation?

Suppose I have: Product(_id,Name) Provider(_id,Name) Provides(ProductId, ProviderId, Price) If I want to obtain the providers who sell the most expensive products, and whose name starts with A. ...
3
votes
2answers
1k views

SQLite writing a query where you select only rows nearest to the hour

I've got a set of data where data has been taken approximately every minute for about three month and the time has been stored as a UNIX timestamp. There is no regularity to the timestamp (i.e. the ...
1
vote
2answers
30 views

Unable to SQL => Getting content of last 7 days

I thought I was good with SQL till I was told to get the content of all 30 days. I do have a column called "connect_time" which has date and time in the following format: 2014-08-28 11:11:42 All my ...
0
votes
1answer
34 views

Alternative to sub query in MS Access

I'm looking into the possibilities for writing queries in MS Access, as my client currently uses Access and would be reluctant to move away to SQL Server. I've been using the data macros (which are ...
1
vote
0answers
17 views

Optimization suggestions for db2 materialized view

I have a view for db2 9.7 which has consolidated o/p from few tables. The view is built and it is working fine I want optimization suggestions on the view SQL CREATE VIEW XYZZ AS SELECT ...
0
votes
0answers
17 views

SQL query to fetch results for multiple many to many relationship tables

We are developing a database for storing licensedetails of source code, archives, shareobjects, binary. We parse a detailed build and extract list of source files that make objects, list of objects ...
0
votes
0answers
11 views

How to join 2 tables and traverse up hierarchy at the same time

Any help that can be given on a current problem I'm having in an Oracle environment would be greatly appreciated. I have 2 tables. One contains jobs to be performed on pieces of equipment, the other ...
-1
votes
0answers
12 views

single column data output multiple column group by value [on hold]

i have a table with column name type_of_ house in which value is 1,2,3 the meaning of 1 is normal,2 is institute and 3 is other . output should be in three column name normal,institute and other with ...
0
votes
1answer
112 views

Automobile database logic

I am building a web based quoting system for a local automobile dealership. I think I have figured out the logic for the databases but I want to get a second opinion before I start just to make sure ...
2
votes
1answer
61 views

Performance impact of Extended Events filter [like_i_sql_unicode_string]

I have created an extended events session in which I wanted to see all queries using nolock hint. I have decided to use it instead of sql trace in order to minimaze possible performance impact. ...
1
vote
0answers
22 views

Creating table with foreign key and index using sqlcmd.exe and batch file [on hold]

I need to create a new table in the database which also has got a few Indexes and Foreign Keys associated. The create script needs to be run using the sqlcmd.exe in a batch file. Assume in the batch ...
0
votes
1answer
35 views

Returning value of insert

I am using Npgsql and I want to be able to do an insert, and if statement that will do an update and then return a value so when ExecuteScalar is called it reads that value. This was done fine in ...
0
votes
0answers
12 views

MySQL hook and alter incoming INSERT queries?

We have an application running on a server which parses an xml data feed into SQL queries and executes them continually 24/7. There is a serious issue in the design of the queries and we need to ...
1
vote
1answer
24 views

Writing a view that caches to another table

I have a table market_trades with columns timestamp, market_id, and amount: api_production=# \d market_trades; Table "public.market_trades" Column | ...
2
votes
1answer
269 views

How to get SQLCMD to output errors and warnings only?

How can you get SQLCMD, when executing a SQL script file, to just output any errors or warnings it encounters? I essentially dont want information based messages to be output.
0
votes
1answer
37 views

Find Without primary key Table in SQL Server 2008 R2? [duplicate]

This is my query to find out primary key, foreign key in SQL Server 2008 R2: select * from information_schema.table_constraints where constraint_type = 'PRIMARY KEY' Know I need to select without ...
1
vote
1answer
85 views

SQL Server Cross Domain Transcational Replication

Has anyone got any documentation for doing/implementing Cross Domain SQL Server 2012/2008R2/2008 transactional replication document or steps (with screenshot or without screenshot) Thanks for your ...
0
votes
0answers
28 views

split single column data into multiple columns using sql

sir i have a column in a table say category in which values (SC,ST,GEN) and i want a output as a how many SC,ST,GEN etc in a single row example with a different column Category SC ST ...
0
votes
1answer
214 views

Error Code: 1133. Can't find any matching row in the user table

Im reading O'Relly "Learning MySQL" and it says that you can create a user in MySQL by doing just this: mysql> GRANT ALL ON *.* TO 'jill'@'%.invyhome.com' IDENTIFIED BY 'the_password'; Query OK, 0 ...
0
votes
2answers
669 views

Inserting data into a table with one value as clob and blob

My table has one clob column and one blob column. I need to insert data into it through insert statements. The length of data to be inserted is more than 4000 chars. When I do export of insert ...
0
votes
0answers
9 views

pre-process, anonymize, data before creating a dump from sql-server [on hold]

I would like to be able to automatically create dumps from a production machine (SQL-Server 2008R2 and up). In those dumps some data needs to be anonymized (mainly by scrambling nvarchar-fields) so no ...
0
votes
0answers
5 views

Netezza Error Record size 120000 exceeds internal limit of 65535 bytes

I have a column PARAM that has JSON data that looks like this: JSON:{"Name":"RES_InformationalIssues","StepName":"Page_1","StepData":"f601e9fe-d68a-4ed7-bbaa-f40c9cbc4d12=General Product ...
1
vote
1answer
77 views

CROSS APPLY versus INNER JOIN

I was reading a lot about CROSS APPLY versus INNER JOIN recently. I tried writing some queries and they both work in a similar fashion, the execution plan seems to be same as well. Maybe someone ...
2
votes
1answer
39 views

Adding Indexes To a Partitioned table in SQL Server 2012

I have recently converted our one large table to use table partitioning in SQL Server 2012. It's a table that stores logs based on a time. So I created a partition function to split the table on my ...
1
vote
1answer
8k views

SQL Server is configured to allow remote connections

I use SQL Server 2012 and SSAS Tabular Mode (My Instance Name Is MSSQLSERVER2012T) Then I download AdventureWorks Tabular Model SQL Server 2012 From This link I open it with Visual Studio 2010 and ...
3
votes
3answers
4k views

How to get last identity row Inserted when using instead of trigger

When I inserted on tables that exists instead of triggers on those. @@Identity , IDENT_CURRENT('Table') and SCOPE_IDENTITY() return null. How I can get last identity of inserted row
7
votes
1answer
305 views

Designing Simple Schema for Disaggregation of Demand Forecast

I am doing a simple database design task as a training exercise where I have to come up with a basic schema design for the following case: I have a parent-child hierarchy of products (example, Raw ...
4
votes
1answer
39 views

Encoding Debug UTF8 & Latin 1

We have on our DB some international people that got some characters saved incorrectly on our DB (MS SQL-Server 2008 R2). For example we have strings like 'WilcoxonÃ'. We got this data into ...
1
vote
2answers
121 views

MYSQL joining 3 tables with left join

I have these tables: pupils: (id_pupil, name, surname, email, user, pass, level, class) incidents: (id_incidents, date, time, type_incident, comments, id_pupil, id_user, subject, id_trimester) ...
1
vote
0answers
161 views

Missing rows in MyISAM tables with 10-20 billion records

I've got 2 tables with 10-20 billion records each. Currently these are in MyISAM (MySQL). They only require to be built and indexed once, after this only SELECT is used. They are currently ...
0
votes
0answers
24 views

Cant Normalize my dimensions and fact table, need help

I have a task at school that I can't get my head around. The task is to create some dimetables and create a facttable from those. The data I have chosen is from Export and Import cost for each year ...
2
votes
1answer
1k views

Extract MySQL information from a compressed tar.gz file

I have a back up-of a MySQL database which is contained in a .tar.gz file - I need to restore it. I've never had to do this before. The only way I can access the database is through phpmyadmin. There ...
0
votes
1answer
54 views

Querying MySQL, duration increases 10x fold after adding one more Join

I have a somewhat complicated query consisting of many joins on an issue tracker/project management database in MySQL. My issue is that my query was doing OK while I was in the process of building it ...