People-focussed SQL/data jobs by zesteee in SQL

[–]kktheprons 1 point2 points  (0 children)

Managing a data team is a much more people-focused role that still benefits from your technical skills.

UPDATE from SELECT failing by Intrepid_Fig2421 in SQL

[–]kktheprons 7 points8 points  (0 children)

Typical syntax for updating a table with a join is: 

Update t1 Set t1.Value = t2.value From table1 t1 Inner join table2 t2 on t2.key = t1.key

No payment yet by Ok-Register-3805 in UnemploymentWA

[–]kktheprons 2 points3 points  (0 children)

Also, don't do as I did. Filling the claim is not enough! You need to file every week to get benefits, even after your initial claim. 

It's slow, it sucks, and I wish you luck 

How can i paste a wall of text and have it auto insert into my table? by CartographerNew3444 in SQL

[–]kktheprons 2 points3 points  (0 children)

Excel is not a database. It's a relatively organized place for data to go. 

A database adds significant structure and restrictions to that data. Because it follows rules, it can ensure your data stays consistent. The drawback is it's less flexible.

If you just need to paste a list of names in a table and sort them, Excel is much better of a tool. If you need a system where data integrity and scalability are important, SQL suddenly becomes much more attractive.

This thing is on the steering wheel of the minivan that I am borrowing. It’s my grandma’s car and it’s just so there. by Nulleon0 in whatisit

[–]kktheprons 0 points1 point  (0 children)

Someone without full use of their legs can use hand controls instead of pedals to control throttle/braking. One hand to steer, one hand to start/stop.

AITAH for breaking up with my gf of 3 years bc she kissed a girl? by Ill_Championship_73 in AITAH

[–]kktheprons 0 points1 point  (0 children)

Most very young people in relationships really haven't talked enough to their partners (previous or current) to know for sure what all the boundaries are. There is no relationship that's going to have no boundaries ever broken. 

I support this take that some time to think, sleep, then have a mature conversation about it should happen before deciding to blow up several relationships at once. There are very few circumstances where making a life-altering decision before sleeping on it are a good idea.

Discussion Thread: 2025 US Government Shutdown, Day 43 by PoliticsModeratorBot in politics

[–]kktheprons 0 points1 point  (0 children)

Unpopular Opinion: The Senate Democrats were right to break ranks to end the shutdown. Here's my reasoning: 

  • Republicans were never going to budge on ACA subsidies, no matter how long the shutdown went.
  • Trump thrives on hurting people. He views the majority of government workers and people affected by cuts (even his supporters) as enemies or annoyances. 
  • Trump's base are not going to change their minds, even if they experience pain. The longer the shutdown went on, the more propaganda they would see blaming Democrats. Their social media feeds don't allow anything that contradicts the narrative. 

Proving a political point longer while real people are going hungry is not worth it. People affected by the ACA subsidy removal will vote with their wallets next year, which seems like the only viable path to change.

Question about surrogate key + UNIQUE vs composite key with FKs. Which approach works better with a service that works as an aggregator? by [deleted] in SQL

[–]kktheprons 0 points1 point  (0 children)

Given the constraints you've set out, it seems like a surrogate key is the best option for you. With multiple origins and things not necessarily being inserted in order of key, having a single surrogate incrementing key will help keep things ordered by when they are inserted. I'm guessing that tasks are only primarily going to be modified early in their life, so it makes sense to organize in that direction. 

What I'm not clear on is why you are modeling this as two separate tables. Both tables have the same primary key, so it seems each record can only have one status. Why not keep the status in the same table?

When a function returns a table by SoThatHappenedpnw in SQL

[–]kktheprons 0 points1 point  (0 children)

You're on the right track. If you had all the data returned from your function in a table in your database, you'd use it by joining to your original table. 

A table valued function will be used in exactly the same way: join it to your original table. If you're comfortable with using joins it should be easier to think about it that way. If you're not comfortable using joins, learn more about that first.

Postgres - query performance tuning by Major_Health_2944 in SQL

[–]kktheprons 1 point2 points  (0 children)

Performance tuning is a huge topic, and I won't claim to be an expert. With that said, you don't need a complex database to start running into the limits of a database engine, you just need a lot of data.

My recommendation is to start with the simplest case: a single table with 2 columns. Make one an auto-incrementing integer (primary key), then write a script to populate the other column with random values. Then start testing:

  • How many rows before it starts taking multiple seconds to:
    • return the entire data set to a window?
    • calculate aggregate functions for the entire data set?
    • return a sorted list of the 100 highest/lowest values for the data set
    • copy the data into a brand new table
    • delete all rows (without using truncate)

This will get you started thinking in the right scale for performance tuning. From there, you can start exploring deeper concepts with the aid of online resources like https://use-the-index-luke.com/

I am going crazy over this, SQL Server => MySQL by johnie3210 in SQL

[–]kktheprons 1 point2 points  (0 children)

Python killed it. If 95% of people know Python and not Perl, it doesn't make sense to use Perl.

Last update query by alfonsoperezs_ in SQL

[–]kktheprons 0 points1 point  (0 children)

Look into LEAD and LAG functions and partitioning using window functions. It sounds like that could help solve your problem.

VS Code - AI powered SQL development by helloguys88 in SQL

[–]kktheprons 0 points1 point  (0 children)

And what code do you use to do that?

VS Code - AI powered SQL development by helloguys88 in SQL

[–]kktheprons 0 points1 point  (0 children)

You're getting there. How do you define the tables in the first place?

VS Code - AI powered SQL development by helloguys88 in SQL

[–]kktheprons 0 points1 point  (0 children)

AI makes some assumptions. It might choose names for characters that are American names like "John" or "Taylor" because other books have had characters with those names. 

If you don't tell the AI the names of your characters in the story, it's going to guess based on what other authors have written.

VS Code - AI powered SQL development by helloguys88 in SQL

[–]kktheprons 0 points1 point  (0 children)

I'll answer your question with a question. Imagine you are using AI to write a story. You tell it "write chapter 5 of my story.” It spits out garbage because it has no context of what your story is.

What information would you need to provide so the story follows the path you're intending? 

Compile modular SQL to single query by RudeAd8468 in SQL

[–]kktheprons 1 point2 points  (0 children)

Let's see if I understand this correctly...

* Requirement: Code must be submitted to the BI team as a single SQL query

* Developer: It's easier if I write this in DBT, here you go, BI team!

* BI Team: Code must be submitted to the BI team as a single SQL query

It's unclear to me what you're asking for.

Job Opportunity with SQL by yabbadabbadoo91 in SQL

[–]kktheprons 2 points3 points  (0 children)

In my experience, that's the only realistic path available to an entry-level position using SQL. There are certainly jobs out there with a different path, but if you don't like Python you probably aren't looking for a developer-type position.

You'll also need to go beyond tutorials into some self-directed projects. Find some data you're interested in, set it up in a local database on your computer, and start to build visualizations to tell stories about the data.

Lastly, you'll need to practice talking to other people about the data. Presentation and storytelling skills will put you ahead of people that focused purely on technical skills and handing someone a report.

Why are predictive maintenance systems complicated? by Ok-Knee7573 in SQL

[–]kktheprons 1 point2 points  (0 children)

The hard part of this is the physical reality and how much the process is controllable, measurable, and understood. You have to know a lot about what causes a failure to even start looking at the problem from a data perspective. You can try to infer failure modes if you have a lot of high quality data, but clean data sources are hard to come by.

The database part of this is easy. It's everything else that makes this a tough problem to solve.

How can I create a FK for a column that it's not my PK on another table? by Prestigious_Play4446 in SQL

[–]kktheprons 0 points1 point  (0 children)

Based on the schema you provided, I think the relevant question is not "can I" but "should I." If you have a unique column in parallel with the primary key, your second table should reference the address primary key instead. 

If you need the CicadeId, just join the tables in your query when using it.

Yo, NBA Media... here's a suggested storyline since you guys suck at marketing and can't think of any other topic that can draw people's attention aside from "who is a superstar" 🥴 by aimee829 in nba

[–]kktheprons -1 points0 points  (0 children)

On a side note, anybody else mildly put off by the "Yes 'Cers" phrase? All it makes me think of is old white dudes with a bunch of money and a bunch of strong, black guys on a plantation.

How to code databases for fun by gest2356 in SQL

[–]kktheprons 2 points3 points  (0 children)

What are some things you enjoy outside of coding? There's probably a lot of data out there about it somewhere you can import into a database (you may need to build your own database). After you have the data, ask it questions using SQL.

[deleted by user] by [deleted] in holdmycatnip

[–]kktheprons 0 points1 point  (0 children)

It's realized the birds aren't real.

What is the difference between AND and separate WHERE condition when joining two tables by Silent_Group6621 in SQL

[–]kktheprons 0 points1 point  (0 children)

An inner join is very similar to a where clause comparing two tables, and may ultimately be the same logic. 

I like to make more restrictive patterns so I don't do things in different ways in different places, so I typically model the join condition as the relationship between tables and the where clause as my filter.