Create new table with references
Reddit » SQL (Structured Query Language)
by /u/nuaje
2h ago
Using: MySQL 8.0.36 I don't have a lot of experience working with SQL so bare with me as I explain what I'm trying to do. I have a a table from which I wanna create new tables from. Assume this is the origin table https://preview.redd.it/ewas00ongevc1.png?width=266&format=png&auto=webp&s=0c44ac8758d45a08f29ff31efb6f3d4f654cf9d5 I would like to create the following tables with the appropriate relations https://preview.redd.it/q915mn8eievc1.png?width=1124&format=png&auto=webp&s=5e086dc5364076807909deb5930c6565019a9fba So far, I've created CampaignCode with the follow ..read more
Visit website
Struggling to understand what's wrong when I'm going by the books
Reddit » SQL (Structured Query Language)
by /u/natevani
7h ago
I'm struggling to understand why the JULIANDAY function in SQLite won't even produce a row, neither will NumberOfOrders. I've been at this problem for hours and I have tried to change the COUNT asterisk to numerous things so if for example, I have 2 orders with equal amounts of days they have been late to add a count to the NumberOfOrders column. Am I just overlooking something? The output should count the total days and if any orders have the same amount of days they've been late from shipping to add a whole number to the NumberOfOrders column. I appreciate any help and or feedback. SELECT C ..read more
Visit website
Question on inserting rows and copying forward most recent non null value
Reddit » SQL (Structured Query Language)
by /u/proone79
8h ago
Say I have a table with 100 columns Every day a new row gets inserted, not all 100 fields will always have data (one unique id will always have a value). Does anyone have an easy way to copy forward the most recent non null value for all inserted null columns for that particular unique id? TIA! submitted by /u/proone79 [visit reddit] [comments ..read more
Visit website
SQL
Reddit » SQL (Structured Query Language)
by /u/SushiGradeChicken
10h ago
It's pronounced "squirrel." Not "sequel." Not "S.Q.L." "Squirrel" Thanks for coming to my TED talk submitted by /u/SushiGradeChicken [visit reddit] [comments ..read more
Visit website
Teradata makes literally no sense at all. How do you learn this trash?
Reddit » SQL (Structured Query Language)
by /u/TotallyHuman5274
13h ago
I've used SQL server and then BigQuery for about 4 years, then switched to a company using Teradata. This is the hottest pile of garbage I've ever used, and I can't wrap my head around it. Half the people in my data org have no comprehension of good SQL writing, and their code is SO MESSY. I mean like random subqueries with subqueries inside of those subqueries, bad aliasing, never any comments so you're like "Why are we adding where clause for ACB-13419?"... But the thing I really don't understand are the common conventions. You can't use CTEs. Performance is always somehow worse using a CTE ..read more
Visit website
SQL
Reddit » SQL (Structured Query Language)
by /u/Particular-Syrup2293
14h ago
I want to be an expert in SQL, R, Python and understand basics of ML, can someone suggest few resources ? submitted by /u/Particular-Syrup2293 [visit reddit] [comments ..read more
Visit website
Issues with CHARINDEX when multiple instances exist.
Reddit » SQL (Structured Query Language)
by /u/TychaBrahe
14h ago
We are using MobiLink to communicate. I am trying to match a username with an ml_database record. The ml_database record looks like username (app version). In order to match, I compare the username to LEFT(username, CHARINDEX('(',username)-2). This works unless the username has parentheses. I have instances where the username might look like "Joe Smith (2)" and the remote_id might look like "Joe Smith (2) (7.1.63.219)". Then my formula will be trying to match Joe Smith (2) and Joe Smith, and will fail. If all of our versions looked like 7.1.63.219 we wouldn't have a problem, but sometimes the ..read more
Visit website
I made a free app to generate SQL queries with AI. You can create an account and add your db schema. It is an early version, but I am actively developing it.
Reddit » SQL (Structured Query Language)
by /u/CowNo3051
14h ago
submitted by /u/CowNo3051 [visit reddit] [comments ..read more
Visit website
Why i don't have any?
Reddit » SQL (Structured Query Language)
by /u/KADIRII10
16h ago
​ https://preview.redd.it/i1xh1r6dmavc1.png?width=724&format=png&auto=webp&s=af24730e623f11826236e2c93554f36e86b2ae01 submitted by /u/KADIRII10 [visit reddit] [comments ..read more
Visit website
SQL CODE - Please provide me the SQL code for this problem
Reddit » SQL (Structured Query Language)
by /u/ANP_SIR
17h ago
Question : Consider you are working with an online grocery delivery business and you want to know the average time from 1st order placed to next order placed until 10th order placed. Write a SQL query based on the below two tables. Users Table Id User Name CreatedAt 24280 Kayla Evans March 6, 2023, 11:42 PM 24603 Nichole Robinson June 21, 2023, 11:04 AM 24812 Amanda Luedtke March 7, 2024, 2:01 PM 25039 Cassandra Nelson March 17, 2023, 8:41 PM 25040 Deena Hougard March 17, 2023, 8:45 PM 25851 John Horihan April 2, 2023, 5:49 PM 25953 Katie Cvelbar April 3, 2023, 7:04 AM Orders Table Id Buy ..read more
Visit website

Follow Reddit » SQL (Structured Query Language) on FeedSpot

Continue with Google
Continue with Apple
OR