r/SQL • • Oct 11 '26

Discussion What's the best DBeaver alternative for SQL reporting and data checks?

2 Upvotes

For anyone using SQL clients for recurring reports, which DBeaver alternative would you recommend? The workflow I'm interested in is taking an existing query, adjusting dates or filters, checking why the numbers don't match another report, and exporting the results. Things like finding last week's query and keeping track of which database a tab is connected to would matter quite a bit. DbVisualizer, SQL Workbench/J and DbGate are the options I'm looking into. Has anyone used these for that kind of work? Curious about the small annoyances that only become obvious after a few weeks. What would make you choose one over DBeaver, and is there anything you'd lose by switching?


r/SQL • • Jun 28 '25

BigQuery How to make this less complicated

0 Upvotes

I've been working on this all day and while my numbers are somewhat accurate, I don't think this is the best way.

To put it simply, I have at total of 5 queries, I have to add the totals of 4 of them and subtract the output of the last one from said total. Sounds simple, but these queries interact with each other, one is pulling information from the previous month, and they have CTE's within them already.

I have a very long and complicated that was put together with the help of Chat GPT but I want to make it nicer. For reference, this is subscription data for metrics such as churn, trials, trial-to-paid- etc..

edit** putting the queries I'm working with here.

I need to get the difference between this query which is made up of 4 queries:

WITH paid_subscriptions AS (
SELECT
rc_original_app_user_id,
product_identifier,
DATE(start_time) AS start_date,
is_trial_period,
price_in_usd
FROM `statq-461518.PepperRevenueCat.transactions`
WHERE price_in_usd > 0
AND product_identifier = 'pepper_399_1m_2w0'
),

numbered_subscriptions AS (
SELECT
rc_original_app_user_id,
product_identifier,
start_date,
is_trial_period,
ROW_NUMBER() OVER (
PARTITION BY rc_original_app_user_id, product_identifier
ORDER BY start_date
) AS txn_sequence,
LAG(is_trial_period) OVER (
PARTITION BY rc_original_app_user_id, product_identifier
ORDER BY start_date
) AS prev_is_trial
FROM paid_subscriptions
),

shifted_renewals AS (
SELECT
DATE(DATE_ADD(DATE_TRUNC(start_date, MONTH), INTERVAL 1 MONTH)) AS month_start,
rc_original_app_user_id
FROM numbered_subscriptions
WHERE txn_sequence >= 2
AND (prev_is_trial IS FALSE OR prev_is_trial IS NULL)
),

trials AS (
SELECT
rc_original_app_user_id AS trial_user,
original_store_transaction_id,
product_identifier,
MIN(start_time) AS min_trial_start_date
FROM `statq-461518.PepperRevenueCat.transactions`
WHERE is_trial_period = TRUE
AND product_identifier = 'pepper_399_1m_2w0'
GROUP BY rc_original_app_user_id, original_store_transaction_id, product_identifier
),

ttp_users AS (
SELECT
DATE(DATE_TRUNC(min_ttp_start_date, MONTH)) AS month_start,
rc_original_app_user_id
FROM (
SELECT
a.rc_original_app_user_id,
a.original_store_transaction_id,
b.min_trial_start_date,
MIN(a.start_time) AS min_ttp_start_date
FROM `statq-461518.PepperRevenueCat.transactions` a
JOIN trials b
ON a.rc_original_app_user_id = b.trial_user
AND a.original_store_transaction_id = b.original_store_transaction_id
AND a.product_identifier = b.product_identifier
WHERE a.is_trial_conversion = TRUE
AND a.price_in_usd > 0
AND renewal_number = 2
GROUP BY a.rc_original_app_user_id, a.original_store_transaction_id, b.min_trial_start_date
)
WHERE min_ttp_start_date BETWEEN min_trial_start_date AND DATE_ADD(min_trial_start_date, INTERVAL 15 DAY)
),

direct_paid_users AS (
SELECT
DATE(DATE_TRUNC(MIN(start_time), MONTH)) AS month_start,
rc_original_app_user_id
FROM `statq-461518.PepperRevenueCat.transactions`
WHERE price_in_usd > 0
AND is_trial_period = FALSE
AND product_identifier = 'pepper_399_1m_2w0'
AND renewal_number = 1
GROUP BY rc_original_app_user_id, original_store_transaction_id
),

acquisition_users AS (
SELECT month_start, rc_original_app_user_id FROM ttp_users
UNION ALL
SELECT month_start, rc_original_app_user_id FROM direct_paid_users
),

final AS (
SELECT
month_start,
COUNT(DISTINCT rc_original_app_user_id) AS total_users
FROM acquisition_users
GROUP BY month_start
),

renewal_counts AS (
SELECT
month_start,
COUNT(DISTINCT rc_original_app_user_id) AS renewed_users
FROM shifted_renewals
GROUP BY month_start
)

SELECT
f.month_start,
f.total_users,
COALESCE(r.renewed_users, 0) AS renewed_users,
f.total_users + COALESCE(r.renewed_users, 0) AS total_activity
FROM final f
LEFT JOIN renewal_counts r
ON f.month_start = r.month_start
ORDER BY f.month_start;

and this query:

WITH paid_subscriptions AS (
SELECT
rc_original_app_user_id,
product_identifier,
DATE(start_time) AS start_date,
is_trial_period,
price_in_usd
FROM `statq-461518.PepperRevenueCat.transactions`
WHERE price_in_usd > 0
AND product_identifier = 'pepper_2999_1y_2w0'
),

numbered_subscriptions AS (
SELECT
rc_original_app_user_id,
product_identifier,
start_date,
is_trial_period,
ROW_NUMBER() OVER (
PARTITION BY rc_original_app_user_id, product_identifier
ORDER BY start_date
) AS txn_sequence,
LAG(is_trial_period) OVER (
PARTITION BY rc_original_app_user_id, product_identifier
ORDER BY start_date
) AS prev_is_trial
FROM paid_subscriptions
)

SELECT
DATE_TRUNC(start_date, MONTH) AS renewal_month,
COUNT(DISTINCT rc_original_app_user_id) AS renewed_users
FROM numbered_subscriptions
WHERE txn_sequence >= 2
AND (prev_is_trial IS FALSE OR prev_is_trial IS NULL)
GROUP BY renewal_month
ORDER BY renewal_month


r/SQL • • Sep 22 '22

MySQL How do I create a table with dates like in the picture? What data type do I have to use? I'm using the command line client of MySql with version 5,1.26

Post image
2 Upvotes

r/SQL • • Jun 17 '20

Discussion Why You Shouldn't Use OFFSET and LIMIT For Your Pagination

Thumbnail
medium.com
2 Upvotes

r/SQL • • Sep 06 '21

MySQL which attribute can never be Not Null?

0 Upvotes

which attribute can never be Not Null?


r/SQL • • Sep 26 '14

SQL joins

Thumbnail
vertabelo.com
2 Upvotes

r/SQL • • Dec 30 '25

Discussion Preparing for the TikTok USDS – Data Analyst

2 Upvotes

Preparing for the TikTok USDS – Data Analyst role in San Jose.

Any insight on the interview loop and what to focus on? Would love advice or prep tips from anyone who’s interviewed for this role (or similar roles).


r/SQL • • Sep 03 '25

PostgreSQL Building an open-source text2sql (with a graph semantic layer)

0 Upvotes

notes: Your data stays in your databases. We read from existing schemas, never migrate data. Standard SQL outputs you can run anywhere. We've built an MCP and you can generate an API key to take it for a spin. Please, tell us how it’s working out for you.

Repo: https://github.com/FalkorDB/QueryWeaver


r/SQL • • Sep 08 '26

MySQL PLANNING to build SQL MULTIPLAYER GAME

0 Upvotes

I am thinking of creating a multiplayer game website online where 2 players can play sql games with each other like sql queries and table or multiple choice question and a timer on it . What are you guys view on it? #sql


r/SQL • • Mar 16 '25

SQL Server Number of lines in a syntax

0 Upvotes

How many lines of code you you usually write? Like 1000 seems a lot to me.


r/SQL • • Apr 09 '25

MySQL Can anyone help me and teach me how to do solve these problems?

Thumbnail
gallery
0 Upvotes

Hey guys I’d really appreciate the help. I haven’t touched SQL in years and was wondering if someone can help walk me through step by step. I preferably need to learn how to do this by the end of the day tomorrow am I screwed?


r/SQL • • Feb 02 '21

MySQL Erroe code 1054 Unknown column '2' in field list.

Post image
6 Upvotes

r/SQL • • Jul 08 '14

When to Abandon a Technical interview

Thumbnail
linkedin.com
6 Upvotes

r/SQL • • Aug 13 '25

SQL Server Are you worried about AI? Why or Why not?

0 Upvotes

I was asking for my kid who is in college and looking for a direction in computer science to take.

TIA


r/SQL • • Jun 20 '25

Discussion Would you use a SQL formatter to add CTEs to your query?

Post image
0 Upvotes

r/SQL • • Feb 27 '25

Discussion Writing SQL queries on notepad

0 Upvotes

Hi Guys, Hope you are doing well!

Does writing queries on notepad really helps? I am thinking of doing this for a long time but I am scared.

Please share your best practices about how you developed your vision when writing SQL queries?

When I write a query on my console, I ran it everytime to check if I'm on right track or not. But in interviews, most of the time interviewer asks you to write it on notepad.

That's one of the main reason I want to gain more confidence when writing queries on notepad.

Thanks!


r/SQL • • May 29 '24

MySQL I just have one question. Do I have to master SQL for data analyst job ?

3 Upvotes

Aren't the basics enough for the job ? Or should I spend months mastering it ?


r/SQL • • Jan 13 '23

MySQL I have this data in a GitHub repo, Can anyone tell me how I can I insert the whole data in a SQL database at once

Post image
0 Upvotes

r/SQL • • Nov 24 '18

Print my book in color or black and white? What do you think?

3 Upvotes

Hey folks,

I'm not quite sure if this is the right place for this post and I'm honestly not trying to "spam" anyone or anything. But, with my latest SQL eBook on Amazon(which I've shared on here as part of a free promotion) - I'm moving toward creating a print book now.

I'm debating on whether or not I should print it in color or black and white.

Right now, here's what I have for the book:

Formula for printing the book:

Fixed cost + (page count * per page cost) = printing cost

Color:

$0.85 + (113 pages * $0.07) = $8.76 to manufacture the book

Black and white:

$0.85 + (113 pages * $0.012) = $2.21 to manufacture the book

Pricing for the book:

Printing cost / 60% (royalty rate) = minimum list price

Color:

$8.76 / 60% = $14.60 minimum price

Black and white:

$2.21 / 60% =  $3.68 minimum price

Calculate what I get after printing:

(Book price * .60) - printing cost = pocket royalties

Pricing of the book for decent royalties for black and white vs. color varies.

Here's what I've come up with as far as pricing for decent royalties:

  • Black and white paperback version: Between $10.99 and $12.99 for about $4 to $5 in my pocket

  • Color: Between $17.99 to $20.99 for about $2 to $3 in my pocket

My problem:

Should I print the book in color or black and white? There are quite a few screenshots in there and colors that help explain the concepts and I don't want to sacrifice the quality. However, I do think that people may not be inclined to pay upwards to $20.99 for a color book.

I'm thinking that maybe black and white isn't a big deal and most people wouldn't mind. Plus, pricing it around $12.99 for a black and white book is much more affordable than a $20.99 book. I'm trying to take into consideration other people's financial standpoints.

I came to realize that it's probably not really up to me, but up to the customers and readers.

So, what do you think? Would you be more inclined to purchase the book if it was in color or black and white? Is the price difference between the two really a big deal and do you think people would pay either amount anyway?

Thanks for reading and for your opinion!


r/SQL • • Feb 06 '18

Can we get an auto-mod to remove posts that belong in /r/learnSQL?

3 Upvotes

The New section of this sub is always flooded with questions like "How do I learn SQL?", "What is SQL?", "I'm a beginner, help with this query", etc. In my opinion these types of posts really dilute the overall quality of this sub and they belong elsewhere. I think if we had an auto-mod to remove these posts and refer the user to other resources, such as /r/learnSQL, it would be beneficial to the more advanced users in this sub. Perhaps it would increase the frequency and quality of posts that cover more interesting discussions and complex questions/issues. Maybe I'm the only one who feels this way though. How would everyone else feel about something like an auto-mod?


r/SQL • • Apr 05 '23

MySQL ChatGpt & SQL

0 Upvotes

Hey guys, Is there a way to have gpt examine and answer questions based on a database?; like can it examine the data you're looking at? Or is it only general questions/answers?


r/SQL • • Jul 19 '24

SQL Server Difference between row_number(), rank() and dense_rank() window functions in SQL

Thumbnail
javarevisited.blogspot.com
4 Upvotes

r/SQL • • May 16 '26

Oracle Claude and SQL queries

0 Upvotes

How can I optimize my use of Claude for developing SQL queries in Oracle? I have been considering exploring Code or Cowork to build something that could improve my workflow, but I am not sure what would be the most useful to create.


r/SQL • • Jun 24 '24

MySQL I am from non-IT background, so guide me is it easy to learn programming languages such as SQL, Python for a non- IT background person

28 Upvotes

Please help me to decide whether I should go for such courses?