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

Implementation of stack in MySQL

I had an abstract idea of implementing a stack in MySQL. Tried a lot of Google work but couldn't reach to any logical conclusion. The Stack must be a collection of tables with the stack top pointing ...
0
votes
1answer
112 views

Connecting to an SQL Azure Database from SSMS - IP Restriction

I am trying to connect to a new SQL Azure Database via SQL Server Management Studio. The client box running SSMS is hosted on a production DB so we restrict access on 1433 to just a handful of IPs ...
0
votes
1answer
58 views

Faster joining on 'most recent' related rows

I have a bug tracking application. The bug table stores very little, because every state change to a bug happens by adding a comment. For example, the current state of a bug is determined by the state ...
0
votes
1answer
243 views

Permission Denied Copy [closed]

I am a beginner learning how to load data and I can't figure out why I can't load this data into postgres. I am using postgres 8.4 on MAC OS. copy tname from '/Users/Shared/folder/file.cxv' ...
0
votes
1answer
97 views

Query taking long time

My query is taking around 540 seconds to get result. Please help me to rewrite it. Query: SELECT pd.domain, fd.passkeyid FROM portfolio.domains AS pd, fabulousdomains.domains AS fd WHERE ...
0
votes
1answer
205 views

Delete with subquery with no unique columns

I have a table LIKES (ID1, ID2). Both id1 and id2 are non unique columns. Database is SQLite delete from LIKES where ID1 = 10 /// Wrong there more then one record with ID1=10 delete from LIKES ...
0
votes
1answer
1k views

Copy files using script to a network share

Is there a simple script I can use to copy files in a particular folder to a network share? This is for use with SQL Server Agent so I can run it as a step after backups. Thanks
0
votes
1answer
1k views

how to return table on sql function

I am very new to sql create function i wanted to check data column value at table the purpose is to return full table where data is null , <0 , >1 the problem is i am trying make data is ...
0
votes
2answers
41 views

SQLQueryTableData-Important

In SQL Server Management Studio, when I run the query select * from tablename it shows me the data. But, that table is not physically present in that database. Is it possible?
0
votes
1answer
328 views

Get ticket sales and reservations grouped by time slot

Ok, I am definitely no guru when it comes to SQL, I will preface this by saying that. Also, hopefully the info I post will be enough for those out there to figure out what I need to do. That being ...
0
votes
1answer
175 views

inconsistent Data Type -ORA-00932

I know there is question related to inconsistent datatypes but that comes from a query. while I am getting this error on database side when we try to access user defined datatype on our schema that ...
0
votes
1answer
3k views

To drop a table, do I have to drop all foreign key constraints or can I just NOCHECK them?

I know you cannot drop a table that has active foreign key constraints. So I was wondering is it safe to: ALTER TABLE myTable NOCHECK CONSTRAINT all DROP TABLE myTable Rather than dropping the ...
0
votes
1answer
3k views

Connect Error (2054) - mysql_old_password issue still not solved

i use php 5.4.3 and i want to connect to a MySQL DB remotely (php script resides on a different server than the db) with normal oop way: $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); ...
0
votes
1answer
1k views

SQL Query Killed, remains in Kill/Rollback with estimated time increasing

I killed a transaction and now it remains in Killed/Rollback status and whenever I run Kill 64 with statusonly I get this output: SPID 64: transaction rollback in progress. Estimated rollback ...
0
votes
2answers
412 views

Indexing a longtext field

I would like to run an index on a longtext field using: CREATE INDEX post_meta ON wp_postmeta (meta_value(8)); There are currently ~1 million records. Questions: Will creating this index affect ...
0
votes
1answer
117 views

MySQL: select a row if that row is equal for every user

In my database I have 5 fix users, lets say user1, ..., user5. Furthermore I have a table month(name, finished, month, year) where name is VARCHAR (the name of one of the five users) and the ...
0
votes
1answer
813 views

Save output from multiple SQL SELECT commands to a file

Within a Postgres function I would like to run a number of SQL SELECT commands and append the output to the same variable. After all the SELECT commands have run this output should be written to a ...
0
votes
1answer
81 views

Is there any way to get recently inserted value in a table without using aggregate functions?

I tried to get the users list who are all accessed our application in past 6 months . In our table , we are storing login_time , user_id ..etc . It's a huge table approximately it will contain over 3 ...
0
votes
2answers
1k views

How to select row and column name where field is null?

I wanted to show row and column where field is null. i already see this example here but i don't understand xml code. my code is like this if exists (select * from Header where [name] is Null ...
0
votes
2answers
472 views

ERROR: could not find array type for datatype information_schema.sql_identifier

I am trying to run the below sql command: SELECT ARRAY( SELECT column_name FROM information_schema.columns WHERE table_name ='gis_field_configuration_stage' ); and I get the below ...
0
votes
1answer
241 views

MAX function and group by usage - postgresql

I am building a ranking algorithm using IMDB's formula: http://stackoverflow.com/questions/1411199/what-is-a-better-way-to-sort-by-a-5-star-rating/1411268#1411268 The formula for calculating the Top ...
0
votes
2answers
297 views

Remote Desktop Session's Machine ID for SQL Server Query

How to get machine name of a user, who is connected on an instance through Remote Desktop and used windows authentication login. I need it for each query she has executed. sys.dm_exec_connections just ...
0
votes
2answers
249 views

How can I simplify this query?

I have written the following SQLite query: SELECT sum(amount) / (julianday('now', '+1 day') - julianday('2012-08-11')) * 14 AS 'Cost Per Fortnight' FROM ( SELECT "transaction".transamount AS ...
0
votes
1answer
159 views

How do you reset the master key in sql server 2005?

Our old DB admin is gone, any ideas? It looks it was set up many years ago.
0
votes
1answer
114 views

clustered index - data warehouse

My source data comes from multiple OLTP databases where the primary key is an identitiy column. We anticipate adding data centers and/or splitting the databases by product. Currently i have one system ...
0
votes
2answers
2k views

Use of CASE statement in a MySQL query

I have 3 tables: TASK (id_task (PRIMARY KEY), name) PROJECT (id_project (PRIMARY KEY), name) PROJECT_HAS_TASK (id_project, task_id) PROJECT_HAS_TASK is the (n,m) relation between PROJECT and TASK. ...
0
votes
1answer
123 views

MySQL query optimization

I'm quite new to big MySQL queries (I used to extract raw data from tables then manipulate them with PHP) so I'd like to know if my query below is too "heavy" or slow for some reason (it seems to be ...
0
votes
3answers
240 views

Pivoting row contents to produce one dimensional result

I have a table with a varchar column containing pipe-delimited values For example: Row 1 Column 1 = a|b|e|gg|foo Row 2 Column 1 = oV|foo|do Row 3 Column 1 = boop How can I query this to return ...
0
votes
1answer
371 views

Massive update to Clob fields oracle 10g

I need to remove a string of characters from 2000+ clobs fields in oracle 10g. How would I do this in PL/SQL? For example, in table t1 there is a clob field called VBase that needs to have the ...
0
votes
1answer
84 views

Logging of incorrect row in SQL Server Integration Services

I newbie to SQL Server Integration Services and I have a problem: Data loaded from file looks like this: 1 'a' 'b' 2 'a' 'b' 1 'c' 'd' And this rows would be loaded in table like this: CREATE ...
0
votes
1answer
727 views

Access query to select multiple records with matching field

I have a table with a list of people ([FirstName], [Surname], [Age]). Some of these people are in the same family. I'd like to return a list of people who have another family member in the table (same ...
0
votes
1answer
208 views

how to pass url value to index [closed]

How to read the value from URL and compare with index that i have created in MYSQL table. I have a form where provide list of selection using drop down list and i pass the selected value to the next ...
0
votes
1answer
174 views

Trouble in Multi-Language DB

I'm working on a DB design for medicines in many countries with different languages. I created a table for the different languages I want and link it to another table of chemicals. But I find that ...
0
votes
3answers
257 views

SQL Server 2008 R2 Remote Connection issue

I have installed SQL Server 2008 R2 in mixed mode, but currently issue is I can't use SQL through ip nor ip with port, even I have enabled TCP/IP and open port in firewall too. I tried to telnet ...
0
votes
1answer
583 views

Database Mail Issue

I am getting a strange error randomly when i try to send emails using database mail using SQL Server. The mail could not be sent to the recipients because of the mail server failure.Exception ...
0
votes
3answers
110 views

How to convert query results into groups of common results

I have a query that returns results like this: MyValue MyGroup _______________|_______________ 56 | I _______________|_______________ 12 | I ...
0
votes
1answer
322 views

PL/pgSQL function + client-side lo_import

I have a problem with importing documents into PostgreSQL. I have a plpgsql function, which simplified could look like this: create function add_file(flag integer, sth varchar) returns void as begin ...
0
votes
1answer
145 views

Simple Search on 13 Terabyte Oracle Database to return relevant rows (.net app? Java?)

I am sure there are some easy ways to do this... I have a simple flat Oracle table which is 13 terabytes or so in size due to a large number of rows accumulating over the years. I need to do a search ...
0
votes
1answer
44 views

Why this query returns rows that I don't want to be there

I'm trying to running this query: SELECT * FROM (`default_users`) LEFT JOIN `default_profiles` ON `default_profiles`.`user_id` = `default_users`.`id` WHERE `default_users`.`group_id` ...
0
votes
3answers
1k views

MySQL Triggers Different Database Different Server

I have two databases, each on a separate server. Each database has a number of similar but not identical tables. I need to combine the records from these similar tables into a new database, which is ...
0
votes
3answers
3k views

Database is not accessible after 'taking it offline' process failed

I was trying to detach the DB when it gave me an error that it is currently in use. Hence, I tried to take my DB offline but it failed saying 'an exception occured while executing a transact SQL ...
0
votes
1answer
497 views

Select DISTINCT records with extra information

I have a MS Access database full of customer names and addresses. I want to send out a mailing but only one per address. Therefore if there are 3 different customers at the address I want only one ...
0
votes
1answer
264 views

MySQL Partition based on month-year

Is there a way that I can create a month-year partition on the below table? Without having to define all the permuations of month/year combos ? CREATE TABLE visitor_visits ( id int(10) UNSIGNED ...
0
votes
2answers
114 views

Very slow request with small difference

I use sqlite3 on a Mac Mini. I'm a Java and Web programmer, with some SQL experience, not as much as an expert. I have three requests. First and second are fast (0.2s), and the third is very slow ...
0
votes
1answer
41 views

field with multiple foreign keys

I have researched this on my own but not really sure of the terms I should use and have not gotten far. Basically I'm trying to figure out how to implements tags for a table row. So if my table was ...
0
votes
1answer
605 views

how do I merge two views

I have basically two views named customerV and productV. the SQL statement in the customerV view is : SELECT CUSTOMER_REGISTRATION.SURNAME, CUSTOMER_REGISTRATION.OTHER_NAME, ...
0
votes
1answer
2k views

How can I select the latest record having one state where no later records exist with any other state?

I want to select the last record (by datetime) having a given state where no later records exist with any other state for each given "widget". widget state timestamp ------ ----- ...
0
votes
1answer
158 views

Sensible data management tool for importing and exporting of large data files

I am looking for some sensible suggestions on data management tools for large data files. I have been experimenting aith excel and access only to find that access has limitations on import files size ...
0
votes
1answer
380 views

MySQL table with multiple values in one field

I'm building a database for a real estate company. The real estate properties are managed by sales people using a CodeIgniter website. How should I proceed with the database design for this table? ...
0
votes
1answer
147 views

I want to be databse specialist (SQL) [closed]

Hello there database specialists, I have Bachelor degree and one part of study was database, where I learned about database design, SQL language... and I'm working with mysql, but I decided to be ...