Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.
My application retrieves a lot of IP geolocation data from https://ipgeolocation.io/ and stores it in a database. Main structure is like this:
ip isp organization
I had to optimize a query that is being exported daily and i did it by creating some table variables. When i try to export the query now with the Import/Export-Wizard, i get an empty csv-file (it has ...
I'm not very at ease with Oracle. My project uses Java 8, Springboot, JpaRepository and an Oracle DB. I've this query in my repository :
@Query("SELECT lex FROM Lexique lex WHERE UPPER(lex.titre) ...
Imagine i have a table like below:
ID Score someOtherColumns
1 1 ....
2 1 .....
3 4 ....
5 2 ....
6 1 ....
where score can have an intger ...
i have problem when update may table
case when NL.[atypcode_type] = 105 THEN NL.[ATYPCODE]
Would it be a problem if select query is on left hand side of where clause rather than right hand side which we usually use.
select * from ABC A where (select ID from XYZ) in (A.ID, A.PID);
Is it ...
Let's say there is a dataset of customers and items. For my analysis, I want to keep only customers that have bought at least N different items and only items that have been bought by at least M ...
I have a file uploaded in:
I want to move this file to:
using sql query command only
I know it is possible with linux commands cd, mv
But in my case,...
Maybe that title isnt really enlightening but i couldnt come with a less contrived one. Here is my problem:
Im working with a table that has data that looks like
id cId ver active
i have created an employee table as
Emp_ID(Primary key), Emp_Name, Address,Designation,Manager_ID(Foreign Key).
foreign key is mapped with the primary key. In manager id column i am entering the id ...
Can you help me solve this issue?
Create SQL view that will combine (union) data from multiple sources, and rename fields to match SSAS. The assumption is that the data is in the same database.
From the share procedure and table duplicate rows are coming in result as in black image shown. As in table only one record matching.
In my table I have to calculate values for different columns. The values can be arrived from current row and previous row. These two column values depends on each other.If I change values of one ...
I started on Symfony and I do not master Doctrine well.
I have entities Packages / User / PackagesDDLExterne
My Package entity corresponds to packages that the User can download.
I have a db2 database where I store names containing special characters. When I try to retrieve them with an internal software, I get proper results. However when I tried to do the same with queries ...
I am getting trouble to write SQL sort Query,
I have table as follows
And I want to sort above data as, First should number and then alphabets and last special symbols like following table.
I am using below sql statement to read and import data from excel spreadsheet to database table:
INSERT INTO [dbo].[TestTable] ([ColumnA], [ColumnB], [ColumnC], [ColumnD])
SELECT A.[AAA], A.[BBB], A.[...
I've got to extract text from an 'unclean' field in our database. Does anybody know how to extract only: 'daily usage too high' from the below examples?
Order: T001.1<br />Rejection Reason: ...
I am making a Java application that uses an existing sql server, but every time I launch the application I get an error:
This driver is not configured for integrated authentication.
WARNING: Failed ...
I have some problems on my server (windows server 2012r2). Memory is always around 80% of usage and sometime, cpu too and the hosted apps crash randomly (OutOfMemoryException).
There is about 110 ...
I keep getting this error when running my stored procedure:
Column '#objects.TableName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY ...
In MsSQL 2014 I`ve got a table containing intervals of values
I need to get the maximum and minimum values of the intersecting ...
I have three tables: person, message and hasfriend. Now I need to show every person that has the same amount of friends and sent messages.
Person has the info of everyone, most importantly the email....
I have two tables ('stock', 'website') have the same structure both has one called 'product_id'
I want to find out in what percentage the product_id in the 'website' table also in 'stock' table
I want to display all the locations that have only one item left. Tried using SUM function but it still gives me multiple rows with the same location, 3 article nr that have sum of 1
SELECT location, ...
I am working on a trigger that is supposed to block an insert when @verkoperstatus is 0; this does function, but for some reason it also stops the insert when @verkoperstatus is 1. What could be the ...
I am trying to fetch the result from the OptionMenu when it is clicked. However I keep getting the error.
AttributeError: 'str' object has no attribute 'set'
I don't know how to solve this as I ...
I have the following table that I need to update:
| ID | ACTIVE | REF_COL | COL_2 | COL_3 |
| 1 | 1 | value | value | value |
| 2 | 0 | ...
I use postgresql
I have a table emails:
id message_id in_reply_to
1 <firstname.lastname@example.org> null
2 <email@example.com> <firstname.lastname@example.org>
I want to append dataframe (pandas) to my table in oracle.
But this code deletes all rows in table:(
My dataframe and my result become this:
0, 0, 0, ML_TEST, 0, 5 //
0, 0, 0, ML_TEST, 0, 6
I have two table in MySQL :
Id_system Name Type
1 'System1' 'Type1'
2 'System2' 'Type1'
3 'System3' 'Type1'
I want to display only the total which are greater than 0.00 but it didn't display all the numbers that are greater than 0.00.
Below is my query:
SELECT t2.mall AS mall,
t3.company AS compname,
I'm working currently on a project and I need to make some functions asynchronously.
I searched for that, and I found that promises will do the work. Here is my code:
var check = `SELECT * FROM ...
I have a SQLite3 database that contains among others these five tables:
Addressbook SQL Schema
Lists can be assigned to contacts and print jobs. If I want to process a print job (e.g. printing ...
I used the code found here http://resolved-error.com/a/17497834/8918324 to make an SQL query that dosen't need to import the libraries for SQL.
The goal is having it run on a server and once a week ...
The problem statement is as mentioned below:
When max_pos> 4 and max_neg is >1
then find out the name of rollercoaster
where intensity_level is greater than excitement_level.
Here, the ...
I have 100s of excel sheets(CSV files) I need to use for the historical load. I am going to load all the CSVs to a stage table using ETL.
I am trying to get the row-wise value from the cell for ...
group by flag;
I have the result set from table as following:
count | flag
I am trying to insert large amount of data from one table from PROD DB to table in Archive DB. Tables are with the identical schema and archive table is with drooped indexes and "Identity insert on". ...
I think this is an very easy question. I want to get the recent date and the oldest date with a SQL query. The Datefield looks like this: 24.04.2019
If I try to get the recent and oldest date with a ...
I am using MS SQL Server Management Studio for SQL queries. Sometimes I join two tables on same column, and it takes really long to execute that query. I can't notice this mistake sometimes and it ...
I have 8 hrs shifts like this in my table Shift and shiftstart and shiftend datatype as time(7).
ShiftNo ShiftName ShiftStart ShiftEnd IsNextDay IsBothNextDay
Publishing database changes with SSDT that include adding columns to the existing table in the target database(which was previously created through SSDT).Instead of creating a new SSDT database.
I have material_info table in oracle db
i want output as below
I'm being asked to find the location of user on a database with time basis.
For example the location detail between the time 7:00 am to 9am, 11:00am to 2pm and 4:00 pm to 7pm.
Big query has timestamp ...
create trigger with status with passed with status = 2 and I need to create a tigger after update row second time when del_status = 2
CREATE TRIGGER `exchange_log_update` AFTER UPDATE ON `exchange`
I am setting up alert using extended event in which I am pulling out info in XML format so I got stuck in finding out the values - Object name from this XML.
SELECT CAST(data AS XML) AS [result]
Lets make it simple: I need counts of all columns from a table. Is it possible to loop through a table names instead of typing each COUNT(column_name) for every single column (if there are >20 columns)...
I have the following extension method to calculate Product's average rating.
public static class Extensions
public static decimal CalculateAverageRating(this ICollection<ProductReview> ...
I can not insert a record in the POSTGRES database, I want the foreign key to be null.
CREATE TABLE sad_avaliado (
id BIGSERIAL NOT NULL,
tenant_id INT8 NOT ...