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
0answers
32 views

draw an ER model using Chen’s notation

hey Guys I need your help with these equations 1- In a faculty office of a department, each faculty has separate printer assigned to her which is connected to her computer. A printer cannot be ...
0
votes
1answer
24 views

What would be most elegant way to replicate data contents periodically into a MySQL table?

I need to parse contents from an API route and insert into a MySQL database. The aim of parsing contents is to replicate the data from the API to my database table. I need to check API response every ...
0
votes
1answer
39 views

Help improving this query using IN

Have a look at this query. Is there anyway of making the IN-statement a JOIN instead? Yes, I'm quite new to this. Thanks in advance for any help. SELECT * FROM company AS t1, employee AS t2 WHERE ...
6
votes
1answer
132 views

What is the difference between <> All and Not In

Could you please tell me the differences between select CustomerId from Customer Where TerritoryId <> All(select TerritoryId from Salesperson) select CustomerId from Customer where TerritoryId ...
1
vote
2answers
44 views

How to calculate the cumulative difference between rows in Postgres?

I am in need of calculating the difference from the cumulative values for the previous day in Postgres based on session_id. Example as mentioned below: Date session_id upload_usage ...
0
votes
3answers
36 views

SQL Server Compact - Will it perform well with heavier traffic sites? [closed]

I'm using Orchard CMS, and on initial setup, the default setting is to use SQL Server Compact. I'm not too knowledgeable about different database types and performance. So, will SQL Server Compact be ...
0
votes
1answer
34 views

How to filter specific entries from a MySql table

I have a MySql table and it has following values. Table name results. Reg.No SubjectCode Attempt Pass/Fail 112108 CMIS 1113 1 fail 112110 CMIS 1114 1 ...
-2
votes
1answer
20 views

Delete into SQL Server loop [on hold]

In case of repetition periods, need to delete the second occurrence (15 to 15 minutes), but the query always returns all or nothing. DECLARE @DatAteTemp DATE DECLARE @HorAteTemp TIME DECLARE ...
1
vote
1answer
41 views

How to remove object from json array?

My table: CREATE TABLE items ( id BIGINT PRIMARY KEY NOT NULL, name VARCHAR, images json ); images format: [ { "id": "owner", "full": "<url>", "thumb": ...
0
votes
1answer
36 views

using update query with subquery in Oracle sql

I have an update query where I am trying to update a field but for more than one record, I am trying a join but it doesn't work. Below I get multiple values that come back from the select statement ...
3
votes
2answers
104 views

Changing metadata changes query output issue [duplicate]

Recently stumbled across the following problem: changing metadata changes query output. Here is how to get it. CREATE TABLE [dbo].[prod] ( [ID] [tinyint] NOT NULL, [values] [tinyint] NOT NULL ) GO ...
1
vote
2answers
97 views

Manipulate SQL statement before execution on server

Our databases are on SQL Server 2000. We are migrating to SQL Server 2008 R2. We want to update the compatibility level to 100. But the join operator \*= and =\* are no more supported with that ...
1
vote
2answers
60 views

Downgrade SQL Server Enterprise Edition to SQL Server Standard Edition

There is a requirement in our project where they want to evaluate if it is possible to downgrade SQL Server from Enterprise to Standard edition and if a server can be decommissioned. Kindly guide me ...
0
votes
1answer
22 views

PostgreSQL - retrieving max primary key column to insert a new row - any alternatives?

We are using a software that needs to request the max primary key column value to add a new row into the table that was requested. I know that there are some alternatives like: Sequences, and GUIDs ...
0
votes
1answer
25 views

Fulltext search not working properly

I have pers table and applied combine fulltext index on (prenom, nom) fields. Below are data in that table. persID prenom nom (pers table) -------------------------------- 116 te te ...
0
votes
1answer
11 views

Filter and then sort products by availability

I have table with products. Each product can be avaible in 1+ suppliers, so product can be present multiple times. products - id_productSupplier (primary key) - id_product (foreign key) - ...
1
vote
2answers
31 views

Mysql fulltext index search returning weird result

I have ingredient table. I want all those recipes which have certain ingredients. Below is my table structure. Table(ingredient) - Applied fulltext index on ingredient column. ...
0
votes
0answers
20 views

Database Read Only after Merge Replication

Win Server 2012, SQL Server 2012 Std. I have a previously accessible database with which I'm testing merge replication and after I publish the DB, my application is saying the DB does not have write ...
0
votes
4answers
40 views

Setting Select Permission on 100+ tables in a database

I got the 'Select permission denied' error for some of my tables in a database. In MS SQL Server 2012, setting Select Permission on 1 table is easy. I just right click on the table > Properties ...
0
votes
0answers
23 views

Slow query on large table after new column is added

I have a table with more than 30 million records, and I recently added a new column with type text. ALTER TABLE database.b ADD COLUMN x TEXT; CREATE INDEX CONCURRENTLY idx_x on database.b(a, x); ...
-1
votes
0answers
23 views

Query to pull data based on conditions from two columns [closed]

I need a help with a sql query. I would appreciate your help Table a -------------- pat_id Table b ----------------- Name Status ABC Not Null BCD Not Null DEF Not Null GHK Not Null I ...
1
vote
1answer
33 views

How to find missing data from one table that is a join of 2 other tables

I have 2 tables, stock and location, with a third table that records the level of stock at each location, stock_loc_info. Each stock item should have a record for each location. What SQL query ...
0
votes
0answers
7 views

create siblings ssas

If you have a parent-child dimension how can the power users easily create new level in the hierarchy? In SSAS is the posiblity to enable WriteBack and easy create new child and new sibling. Can you ...
2
votes
3answers
87 views

Return total number of rows and selected (aggregated) data

I have a function which is selecting some data from a table. I would like to return the selected data and the total number of rows in that table. How can I do that or how can I get the same result in ...
4
votes
6answers
138 views

Select rows with same id but null and some other value in another column for that id

I want to get only rows having a value NULL and some other value than NULL for a particular username column. If both rows have null for that particular username or both have some values other than ...
0
votes
1answer
42 views

Many mysql queries stuck at sending data

I am using opencart and I can se many queries blocking the mysql server. All queries are the same except the p.manufacturer_id. Attached there is the query and the explain of the query. The query is ...
0
votes
4answers
39 views

Single SQL query to retrieve data in a particular order (not ASC/DESC)

I have a MySQL table, let's say called reviews review_id, product_id, language_id, rating, review, author language_id ranges from 1 to 10 for 10 different languages. Let's say I determine that my ...
0
votes
2answers
60 views

How to import DB with .sql extension into SQL Server 2012?

I have a database with .sql extension which is exported from server using putty. How to import this into SQL Server 2012 in Management Studio? It is not accepting .sql as database, throwing error. ...
0
votes
0answers
21 views

Insert values from one database table to other database table through shell scripting

I am working with 2 databases say logdb.db and logdb2.db . I have created a table named Original in logdb.db Sqlite database such as follows : CREATE TABLE Original (s_id INT PRIMARY KEY NOT NULL ...
1
vote
0answers
58 views

Non clustered indexes

I have a questions on Index Our Application is throwing the following SQL eroor Index 'INDEXNAME' on table 'dbo.TABLENAME' (specified in the FROM clause) does not exist. Error: Unknown Error ...
1
vote
0answers
28 views

Did I Properly Diagnose That It's Not A SQL Server Issue?

We have a job that populates about 450,000 rows nightly in an update/insert job via a stored proc nightly. The .Net app pulls in data from a noSQL DB via an API call then pushes it out via a stored ...
0
votes
1answer
21 views

How to get Location name from Hierarchical data in Mysql

I have table Location like this: ID, PID, Location 1 NuLL Country 2 1 City 3 2 County 4 3 District 5 4 Social How can I make a view in MySQL that ...
0
votes
0answers
31 views

How to tell which process in SQL Server I should kill?

I am having an issue with an application as it is running supper slow. I don't know if it is a database issue or something else as the is nothing that I can find to be the issue. I tried select * ...
0
votes
1answer
21 views

convert update field second to time

I have 2 fields ( about 1000 records) name FROMTIME and TOTIME. Both fields will have time in seconds (for example FROMTIME = 20520 and TOTIME = 39360). I would like to convert and update these ...
0
votes
1answer
35 views

Dynamic Pivot with overlapping years

I have looked and cannot find how to show the last # months in a pivot table. Everything I seem to run across codes months statically. I'm seeking a solution that shows something similar to the ...
4
votes
1answer
267 views

Restarting database server or just the database

I am an application programmer. We have a SQL server 2012 instance that hosts many related databases(around 12 databases). The vendors did some changes to one of the database and the application and ...
0
votes
2answers
50 views

Can an EXISTS clause be improved when the condition is checked for the same value multiple times?

Assume that I'm modelling a Blog engine. Blogs have n Posts. Each User can be granted a role on different Blogs (Admin, Approver or Editor stored as enums/ints). Each Post can have a State (Draft, ...
0
votes
0answers
24 views

Count responses based on tale structure given below

Table:Answer_Master id_answer answer id_question 1 Yes 1 2 No 1 3 Yes ...
0
votes
0answers
35 views

Query on a SQL Server view with openquery to Hive returning wrong answer

I have a view in a SQL Server instance which is running an OPENQUERY to Hive through MS OLE DB Provider. The view is getting all the records from the Hive table without any WHERE clause. Now, I ...
-1
votes
0answers
22 views

I want to select the latest record for each loc_id [duplicate]

Below given is the screen shot of what i was trying. I want to select the latest record for each loc_id (7,960,1152). I can't use TOP as it will select the top most record only and that even for the ...
0
votes
0answers
23 views

Run a specific SQL Server job step from a stored procedure

I have a job with 5 steps that are scheduled to run after each other. I want to have a stored procedure where a user can execute the stored procedure and give the step number as a parameter. Only ...
0
votes
0answers
9 views

Deployed packages getting into the wrong folder

Package in my SSIS when I deploy them are getting save in the File System folder rather than the MSDB folder. Why? How do I change the location of these packages to MSDB?
3
votes
1answer
66 views

How can I create notification on user's connecting to database?

I have users that have access to several databases. I used to have an alert and notification sent to me when a specific user connects to a specific database, but I accidentally clobbered it. Now I ...
0
votes
2answers
42 views

update column based on sum of data from another table

I have two tables : Table1 (col1, col2, col3, col4, val1, status) Table2 (col1, col2, col3, col4, val2) For Table1 and Table2, The columns (col1, col2, col3, col4) are the composite primary key. ...
-1
votes
0answers
38 views

Microsoft SQL Server 2012 Express Edition upgrade it to Microsoft SQL Server 2012 Standard Edition [on hold]

How to upgrade Microsoft SQL Server 2012 Express Edition (64-bit) to Microsoft SQL Server 2012 Standard Edition (64-bit) ? Purpose of doing is Express will not supporting Mirroring. Thanks
0
votes
0answers
31 views

SQL Database query working really slowly

I have a database with two columns: 1)Word 2) Times Used When the user enters a word it find the combination of words already typed (ex: combo = hello world) and updates the database using a ...
1
vote
0answers
15 views

Enforce referential integrity for FriendRequest table that has UserA and UserB

I have a table called User that has UserName as a primary key. I want to establish a relationship with enforced referential integrity between User and FriendRequest. FriendRequest has the following: ...
0
votes
1answer
45 views

Delete duplicate records by column 1 but having differ values in column 2 and column 3 [closed]

I have a table like: SSN FName LName 1 a b 1 a b 1 b b -------------> to delete 2 c d 2 c d as above example I want to delete such records where SSN has different values in ...
1
vote
0answers
56 views

SQL SERVER 2005 slow Performance on Windows Server 2008

Recently i have upgraded my server to new one. But because of compatibility issues with my old Windows Server 2003 R2 32 bit, I have also upgraded it to Windows Server 2008 R2 64 bit. (i have ...
0
votes
2answers
30 views

Report individual changes to data

I need to produce a daily extract on the individual changes to a dataset. So, there are 14 tables containing product and customer information and the extract must only show records from each table ...