Tagged Questions

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

Select all results from two independent tables

I have two tables: Comments -------- id comment_content time_stamp Activities ----------- id activity_content time_stamp And I would like to combine the results from both, ordered by their ...
0
votes
0answers
9 views

Clearing log files

How to clear/Shrink the Log file of a database when the database is in stand by mode. How to make a database from recovery mode(normal mode/with recovery) to standby mode.
0
votes
2answers
21 views

Delete duplicates with speicifc columns as identifier

I'm required to delete all duplicate entries of a table. The duplicates are identified by two non-key values num (int) and com (varbinary(512)).. My amateur-ish SQLfoo lead me to this non-functioning ...
0
votes
1answer
37 views

What is my database name?

I'm trying to connect to a microsoft SQL database but I dont know its name. I suspect it will be something of the form servername\databasename It would be good if I could just use SELECT ...
1
vote
0answers
17 views

Clustered Column store table Delete error

I am getting the below error when we tried to delete records on clustered column store table using OPENDATASOURCE. DELETE TOP (1) OPENDATASOURCE('SQLNCLI','Data Source=Server Name;Integrated ...
1
vote
2answers
25 views

How long to learn PostgreSQL?

I want to learn PostgreSQL and How to make the learning process efficient, but really don't know how long it would take even after googling my question. I used MySQL before and knew relational ...
0
votes
2answers
33 views

SQL Query: Selecting a person who is a member of all existing groups

I'm tinkering around with my very first SQL queries and am completely baffled by a problem I encountered. Let's say I have the following database: PERSON(PID, Name) MEMBER(PID, GroupID) How would ...
0
votes
0answers
44 views

How to recursively find gaps where 90 days passed, between rows

This is a kind of trivial task in my C# homeworld, but I don't yet make it in SQL and would prefer to solve it set-based (without cursors). A resultset should come from a query like this. SELECT ...
0
votes
0answers
19 views

Continuously copying an SQLite table

I have a SQLite database associated with an online application (Skype) on my computer, which is often changed by that application when I am using Internet. These are the columns of the database: ...
0
votes
3answers
35 views

SQL MAX function

Suppose I have a table with attributes Name, Age as follows: MyTable (Name, Age) Now, to get the oldest age I can write the following query: SELECT MAX(Age) AS "Oldest Age" FROM MyTable; ...
0
votes
0answers
10 views

reports on history table

Assume Trucks which travel between Cityies. I store the Cityies that a Truck has traveled to in TruckLocationHistory table, if the Truck is passing the City, State = Passed and if it gonna stays for ...
0
votes
1answer
11 views

check numeric column for empty cells

How can I check for a numeric column for empty values I want something like this: select * from table where column_numeric = '' This does not works obviously, but what can be the equivalent of ...
-1
votes
1answer
32 views

how to select from two tables [on hold]

how to select data from two table like this table 1 ---------------------------------------------------------------- proid | uid | problem | prostatus ...
0
votes
0answers
18 views

self referencing tables with SQL and entity framework

I have many tables in a database and the tables are nearly identical. There are limitations currently on what objects reference other objects. For example I have company,contact and project. Contact ...
-3
votes
0answers
37 views

How do I show all records related to a user? [on hold]

I have a table in which a few records are stored, among others CSR and user. What would be the correct way to get all records where user's value = test? My SQL file: -- phpMyAdmin SQL Dump -- ...
-2
votes
2answers
50 views

What's wrong with my SQL statement? [on hold]

I'm trying to execute: create table `certificates`( `id` INT NOT NULL AUTO_INCREMENT, `common_name` VARCHAR(100) NOT NULL, `csr` LONGTEXT NOT NULL, `type` VARCHAR(100) NOT NULL, `certificate` ...
0
votes
2answers
40 views

Summarizing Pay Checks Based on Employee's Job Code

What I'm trying to do is summarize an employee's earnings for each job code they worked in for the year. Employees are assigned a job code based on an effective date. I'm trying to line up the job ...
0
votes
1answer
33 views

Database Normal Form (financial statement)

I would like some advice on how to design the database for financial statement data which objectively addresses the tradeoffs between usability, performance, maintenance and adherence to normal form. ...
0
votes
0answers
21 views

problem in connecting SQL Server for internet access

I'm having a problem connecting SQL Server for internet access. I have built a test server so that I can play at home and not kill the works server. I've been trying for days and so far I have: My ...
0
votes
0answers
40 views

Size of Table Now vs 2 Years ago [on hold]

I am trying to Analyze the growth of the data/tables within a database. I would like to analyze how much Data is currently present in a table and how much there was 2 years ago. There are date fields ...
1
vote
1answer
58 views

How to combine two queries?

I can't explain this very well except by spelling it out. I start a query on ID, and from there I can get TITLE, DATE, and REGNUMBER. The problem is I also want to get 'where,' which is also stored ...
-2
votes
0answers
44 views

Joining Multiple Tables in Sql Query [on hold]

I have four tables with their attributes; namely Check_Gauge, Storage_Facility, Product, Product_Brought. The first three tables are related through their primary keys. Product_Brought is not ...
2
votes
2answers
42 views

How can I simplify this UNION?

Here's the case - I have the following query: SELECT DISTINCT post_id FROM ( ( SELECT DISTINCT rp.post_id, pm.meta_value AS premiere_date FROM wp_related_people AS rp JOIN ...
1
vote
2answers
38 views

Remove duplicates and connect relations to the first one

Guess I can use some help over here. I have split a products table into two tables, products and prices. This is the original table: products: +----+--------+-----------+-----------+-----------+ | ...
1
vote
0answers
31 views

Allowing users access to SQLPLUS and to compile PLSQL [duplicate]

As a DBA - assuming my users are knowledgeable with PLSQL and SQL - why would I not grant my users privileges to compile and run their own PLSQL code. We have an MI database environment where the data ...
1
vote
3answers
15 views

Allowing users to compile / run PLSQL and SQL

As a DBA - assuming my users are knowledgeable with PLSQL and SQL - why would I not grant my users privileges to compile and run their own PLSQL code. We have an MI database environment where the data ...
1
vote
0answers
14 views

Convert a list into one row with dynamic column in MySQL [duplicate]

I have a list of row to be converted into a dynamic column that depends on the record in one particular column. From this statement FID |Steps | Action ---- |------|-------- 1416 | 1 | Sit ...
2
votes
0answers
22 views

Wich is the most efficient/easy way for end-user to get data from Analysis database?

I know that you can quey a cube by connecting from excel to Analysis database and using formulas like cubevalue() or cubemember(). I also know that after converting the power pivot to formulas you can ...
1
vote
0answers
32 views

How to query sum all the wins of each team

Matches ID| radiant_name | dire_name | radiant_win 1 | LV | LGD | true 2 | LGD | LV | false 3 | LV | LGD | false 4 | LV | LGD | false ...
1
vote
1answer
34 views

How to restrict access to current user record and its rights in postgres

Postgres 9 database contains additional information about postgres users: create table public.user ( user char(10) primary key, -- CURRENT_USER in postgres name char(30) ); and user roles; ...
0
votes
1answer
43 views

MySQL-How to find that value in a column is subset with all other values in same column multiple time

I have a table named as Team where table contain 3 column (ID,Team,Task). Its datatypes are (INT,VARCHAR(255),INT). Below you will find a sample table where I would like to perform the query on column ...
-4
votes
0answers
33 views

Defining Role of Super Admin, Admin and User from DB table [on hold]

I have a column in my sql table where I want to define the role of the user. If User is SuperAdmin its value will be -> 0. For Admins it will be -> 1 For Users it will be -> 2. Also. I have column ...
2
votes
2answers
37 views

Multiple Instance with different service packs in SQL Server

I would like to install a Default instance with SQL Server 2008 R2 RTM and I want to install another named instance with SQL Server 2008 R2 SP2. Is this possible?
4
votes
0answers
94 views

There is insufficient system memory in resource pool 'internal' to run this query

One of our production servers reporting error in log Error: 701, Severity: 17, State: 123. There is insufficient system memory in resource pool 'internal' to run this query. I searched for ...
0
votes
1answer
15 views

Reviewing Stored Procedure template for handling transaction?

I've prepare a template for SQL Server stored procedures which will have Insert, delete, Update transaction. I have a stored procedure to log error in catch block in a table. How can I improve my ...
0
votes
0answers
38 views

select sequential rows

How would I go about selecting a sequence of rows. Where every row in the sequence: Must only be 1 day apart ~ Thereby the whole sequence of rows must have sequential dates Must have a count higher ...
2
votes
1answer
22 views

Changing feature on a database that is a member of SQL Server AlwaysOn availability group

Our developers need a change on a database that is in the Availability group (they need Service broker in one of the databases to be enabled) but when I try to do it I am getting error saying that I ...
2
votes
3answers
52 views

Bulk Delete for Large Table in MySQL

I have a Notification table contains about 100 million rows host in Amazon RDS with 1000 IOPS, and I want to delete those rows older than one month. If I do DELETE FROM NOTIFICATION WHERE CreatedAt ...
0
votes
0answers
26 views

PL/SQL IDE like C++ compilers [on hold]

Are there IDEs out there like Codeblocks that can help debug syntax errors in PL/SQL scripts? I am currently using Oracle XE and trying to create a PL/SQL script.
1
vote
1answer
21 views

CONCAT() between different alphabet echoes out '&' ampersand

I want to concatenate different alphabet strings and get a weird latin encoding with ampersands after the sixth greek character (I want to concatenate greek and english alphabet strings). Lets say I ...
0
votes
2answers
50 views

How to use max function in such condition?

My query is select * from guestuser union select * from olduser ORDER BY userid DESC LIMIT 1; Is that correct query to find last userid from different table have different userid? can i change ...
0
votes
0answers
55 views

Query that can pick up data that falls between rows having unique parameter [on hold]

Suppose a table has data in the following format: Id Name ----------- Main Abc Check Def Check Ghi Main Jkl Check Mno Check ...
0
votes
0answers
21 views

Need some questions to show some trends [on hold]

I have a college project:create a database from a dataset and normalize it. I also have to do some trend and data analysis via sql queries, reports, etc. Please give me some interesting questions for ...
2
votes
1answer
37 views

I am Trying to Write an Access Query to Get a person having a First Name and Last Name but not all People having any of those names

I am using Microsoft Access. In my search form I have 3 text boxes that I enter text to search for: First Name; Last Name; Last 4 of SSN. With the current query when I enter text into multiple boxes ...
1
vote
0answers
17 views

MySQL - Transactions and causality

I'm new to MySQL's LOCK and TRANSACTION and have a question about different isolation levels of a transaction: Given two transactions executing the same code (auto-commit is false): (1) get data of ...
0
votes
0answers
55 views

Improving Statistics for Query Plan

I have a table with over 2.1 million rows. This table has a column rID, which joins to a PK on another table. As you can see from the distribution below, most rows contain a null for rID; which ...
0
votes
2answers
37 views

SQL: TSQL to Find invalid views

we have a Tuesday/Thursday Maint window for one application we support. On Tuesdays we modify one facility and thursday if there are no errors we roll all the changes out to the other facilities. The ...
2
votes
1answer
78 views

Database Implementations of ORDER BY in a Subquery [closed]

I am using an application (MapServer - http://mapserver.org/) that wraps SQL statements, so that the ORDER BY statement is in the inner query. E.g. SELECT * FROM ( SELECT ID, GEOM, Name ...
-3
votes
1answer
21 views

Which is best tool for database backup file encryption? [closed]

Which is best tool for database backup file encryption other than TDE and inbuilt feature of SQL server 2014. I want to do as follows, Take a database backup in SQL Server Encrypt with third party ...
-1
votes
0answers
39 views

SQL Server is very slow [closed]

In company with 30 clients(computers), after 3-4 hours working with financial software, SQL Server is very slow SQL Server can not free used memory and the query execution time is very slow but after ...