Questions tagged [sql]

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

How can I create a table from an existing table in SQL but using cells from the old table as columns in the new table?

I have a table, and I want to create a new table such as the one below (from the table above) In SQL, I tried using the following commands. I am able to generate a table with only one column like ...
0
votes
0answers
8 views

How to calculate date range constrained average Lifetime Value within Data Studio?

So within a data studio dashboard, I have a number of metrics e.g. Total Orders, Total Sales, Average order value etc. with YoY indicators as shown below: And all the metrics are working fine with ...
0
votes
0answers
22 views

Load data from SQL for Machine Learning

I have an SQL DB which has millions of records(10 years of data) and wanted to implement some ML Models. Most of the courses/tutorials explains using a local file or downloaded CSV. But in my case I ...
0
votes
0answers
6 views

Merging and deduplicating mass amounts of data in ORC on a 24 hour interval

I have the following problem I'm looking to ideate on and looking for advice on how to think about it from a data science perspective. I'll keep the numbers small for simplicity. Day 1 I get 100 ...
0
votes
0answers
16 views

Database modelling

I'm trying to model a database for Disney+ shows, but I'm stuck at this part where I need to be able to model in a way such that Disney will be able to create a list of top 10 movies every week based ...
0
votes
0answers
9 views

Working with mySQL and pytorch Dataset

I am working with high frequency time indexed data. We have 2 types of data each with about 5 columns. For each type of data we have 2500 streams coming in and being updated every 1ms-100ms (the ...
1
vote
0answers
21 views

Create an amortization table with SQL [closed]

I have a list of credits, let's assume they are only two for ease: Credit #1 and credit #2: One has 3 months of payments missing and the other has 6 months left of payments. It would like to obtain a ...
0
votes
0answers
8 views

Restriction inside a que

There's a way to use information of one column as restriction for where in the same query? Picture that: I have my user_table like so: user_id name age gender lvl ...
0
votes
0answers
21 views

Why does a simple query succeed in mysql but fail in druid?

I have a mysql database table with only one column called __time which stores a time stamp. The following query works perfectly and will return the ...
1
vote
1answer
27 views

Optimization technique for iterative distribution

Apologies if this does not fit the proper format for this site, as it is a somewhat general question. I have an application that sits on top of a SQL database, and need to handle a process which is ...
0
votes
0answers
11 views

query category wise dara

I have stored the some products and there respective category in sql. Like this. Now I want fetch all product from table with respective category. output should be=>
0
votes
0answers
6 views

How to change data source names in Google Data Studio

Google Data Studio has connectors to MySQL, PostgreSQL, etc. but these connections will come with default names. Couldn't find out how to set the names for data sources in Google Data Studio. Is it ...
0
votes
0answers
9 views

Generating prediction when adding new rows into a relational dataset

There is a PostgreSQL table that I regularly update with new book reviews. Meanwhile, I also have trained a Tensorflow model that takes book review text and return a predicted book review category (an ...
-1
votes
1answer
37 views

Tools for a data science job [closed]

Could someone list out all the important tools and software required for a data science job? Example spark, tensorflow, SQL, tableau etc. It would be helpful if you could list the domain and then 2 ...
1
vote
0answers
4 views

Hive Bring Table to Local Driver for Fast Debugging on CLI

I have a large Hive table on HDFS. Every time I query it, it runs a map reduce job which is slow. For debugging my code on CLI, I want a fast query. Is it possible to sample rows of the table and ...
0
votes
0answers
30 views

Looking for a web based tool for natural language to PostgreSQL query for custom database

I need to build a web-based solution that will take a natural language query in English, convert it into an SQL query that I need to execute on a PostgreSQL database. I tried ln2sql/nl2sql but it only ...
0
votes
1answer
25 views

Get the average time between first and 2nd call (postgresql)

I have the following data in table where I want to calculate the average time between 1st and 2nd call. I know how to get the average, but I have a though time to figure out how to subtract the 2nd ...
0
votes
1answer
63 views

Running a query in R after establishing dbconnect

I do not seem to figure out what is wrong it the following statment. The connection to the DWH is establishe but the query statement in R seems not to work, with the following error : ...
0
votes
0answers
13 views

Manually rollbacking JDBC transaction or just leaving it to the database

When managing transactions through JDBC, should I manually rollback if some exception occurs or leave it to the database to do the rollback on its own? The database in question is Postgresql. As far ...
1
vote
1answer
100 views

Removing outliers with orders of magnitude differences

I have a dataset of virtual currency earn and spend events from a mobile game app. Unfortunately, people cheat in the game to get more currencies. These cheaters use different techniques so its quite ...
0
votes
1answer
11 views

Getting the earliest date (duplicates due to several call ids and agents)

I am trying to get the earliest call interaction, with only the agent that interacted at that call and the customer id. Using the following code, I still get duplicates: ...
0
votes
0answers
26 views

Natural Language to SQL Training Data for German Language

I need to train/implement a model that translates natural language questions in German into SQL queries. For supervised models, this means that a lot of training data is needed, which would be a ...
7
votes
2answers
203 views

How important is advanced SQL for data science?

Is advanced level SQL required to be competitive as a data scientist? Is it more important for a data analyst to be good in SQL? Is it enough to be able to extract data using simple SQL queries? I ...
2
votes
1answer
37 views

Storing and collecting data [closed]

I wanted to ask you which coding language I should use. I am pretty new to coding and could really use some help. As I mentioned above I want to create a survey and afterward store my results in a ...
1
vote
1answer
2k views

Passing tuples (key, value) into parameterized SQL query in Python

NOTE: I am new to this community, so please let me know if I can help you help me! I built a scraper in python that creates a tuple of (key, value). I would like to pass both key and value as ...
1
vote
0answers
22 views

Are there decisive leaders in programming with tabular data?

What are the most effective bread-and-butter in-memory open source tabular data frameworks today? I have been working with tabular data for years with an in-house solution that integrates with Excel ...
1
vote
0answers
13 views

Getting transportation turnover as null when i filtered by Product nature [closed]

I am pretty new to SQL. When i tried the following query i am getting sum as 0. Can somebody explain me the problem of the query. ...
1
vote
0answers
51 views

SQL Oracle - Excel's BETAINV function (Inverse cumulative function of a beta distribution) in SQL Oracle [closed]

Is there a function equal to Excel's BETAINV(probability,alpha,beta,[A],[B]) in Oracle SQL Developer? Or a similar one which I could use to return the inverse cumulative distribution function of a ...
1
vote
1answer
22 views

How to group by ID, and output without repeating IDs? [closed]

Input UserID Profile 101 apple 102 banana 103 pie 101 banana 102 pine 103 berry Output ...
2
votes
1answer
74 views

Format of data in SQL for machine learning

I am a beginner at Machine Learning and am starting out on a ML project. I have a large chunk of the source material and have started extracting the data from it to be stored in SQL (initial test with ...
1
vote
1answer
26 views

Scraping mixed elements and passing to SQL

I'm running webscrapes via python which are retrieving data from csv's hosted on the web. I'd like to pass the data into a MSSQL database. An issue I have is the mixed elements/data types in the csv....
1
vote
1answer
1k views

How to plot time series data from SQLite database

I am trying to plot time series data by accessing the SQLite database. I successfully connect the database by coding the below script,however, i couldn't figure out how to plot the time series data ...
1
vote
1answer
114 views

SQL and JSON database - R

I have a database (PostgresSQL) which looks like this: ""results"": {""WEBS"": {""WEBS_4"": [{""ip"": ""XXXXX"", ""value"": ""YYYY""}]}} I would ...
0
votes
1answer
81 views

How to store subset of columns from a csv file?

I need to create a table in hive (or Impala) by reading from a csv file (named file.csv), ...
1
vote
0answers
151 views

Self Union All in Tableau Public for Sankey Diagram

I'm following this 2017 YouTube tutorial from which I hope to learn Sankey diagrams. At 2:28, he instructs us to select Convert to Custom SQL, after having opened ...
0
votes
1answer
44 views

How to execute a git project with different input data?

I would like to run this project and receive result from this project However I have problem to execute the step mailcorpus.json created by executing the sql script data/get_mail_corpus.sql on ...
0
votes
1answer
29 views

CASE sentence for SQL query

I have a question abut MySQL I would like to handle a column with characters without changing the original DB. Below is the levels of the column named 'Maker'. 기아, 현대, BMW, VolksWagen, Porsche So ...
1
vote
1answer
335 views

What should I master better for professional data science in economics and finance? [closed]

First, excuse me for the noob and long question which is probably doesn’t even belong to here, I know there are several question been answered like this out there, but I think this is going to be up-...
3
votes
2answers
814 views

How to deal with millions or rows of data for analysis/visualization purpose [closed]

I have data in 2 tables in Sql server. First table has around 10 million rows and 8 columns. Second table has 6 million rows and 60 columns. I want to import those tables into a Python notebook ...
5
votes
1answer
43 views

Data enrichment of geographical records

I have a user_data table with various fields, some of them are based on geography. I'd like to enrich the data with additional columns, like ...
4
votes
4answers
80 views

How do Data Scientists integrate Predictive Modeling with SQL?

I've heard a lot about the importance of knowing SQL but how do you guys at the larger firms integrate your software for modeling/analysis with the server that holds the data? Do you simply access ...
1
vote
1answer
33 views

Analyze additions and subtractions to/from a data set

I have a data set in the following form: ...
2
votes
2answers
41 views

Find closest numbers approximately

I have a table like this; all columns are numeric: TableTest Col1 Col2 Col3 Col4 5 6 7 8 12 6 5 6 2 3.5 6 1 And I want to ...
0
votes
1answer
2k views

Python & Pandas : (pymysql.err.OperationalError) (2003, “Can't connect to MySQL server on 'localhost' (timed out)”)

I'm writing a Python Script to store JSON data into MySQL Database. I used pandas to store into MySQL Database. I used two different modules (...
4
votes
1answer
5k views

Python & Pandas : TypeError: to_sql() got an unexpected keyword argument 'flavor'

I want to store JSON Data into MySQL Database using Python. I used dataframe of pandas. I found that ...
3
votes
1answer
50 views

How to find the values that never matched in a full join

Hello I have done this full join query: ...
1
vote
0answers
17 views

Qualitative prediction based off data containing mixed qualitative and quantitative values? [closed]

I'm trying to find a way to predict an integer value based off of an item's prior sale history and am inquiring for a starting point on how to approach this. The factors are as follows (Data Type in ...
3
votes
2answers
3k views

Mean across every several rows in pandas

I have a table of features and labels where each row has a time stamp. Labels are categorical. They go in a batch where one label repeats several times. Batches with the same label do not have a ...
0
votes
1answer
148 views

What algorithms can be used to derive matching rules between known matches in datasets?

Lets say I have two datasets with different column names except for a unique ID key Table 1 CSV ...
1
vote
1answer
500 views

What algorithm could be used to fuzzy merge multiple datasets?

Problem Description I have several tables that are related but do not share any unique key. I've come across this problem several times with customer data in separate source systems that needs to be ...