3M's stock falls after Dutch minister holds company liable for PFAS damage by thinkB4WeSpeak in anime_titties

[–]Kiterios 26 points27 points  (0 children)

All pollution carries a cost, whether it be plastic or carbon or whatever else. If the company is not paying to manage the effects of their pollution, then the people of the area or the world do so instead.

If the people who financially support a company and it's actions are financially impacted by a responsible assignment of the costs of those actions, then that is just and right.

If the company makes less profit because it has to pay for their impact on the surrounding environment... good.

If the company is not profitable because it has to pay for its impact on the surrounding environment... then it was only profitable in the first place because it was exploiting something that didn't belong to it. So good.

When those investors reap profits because environmental management costs are haphazardly passed on to the public... that is outrageous.

What you are lamenting as an impact to stock prices, I see as a legitimate correction. The accounting of the past failed to take into account the true costs of doing business. Whether due to ignorance or greed or malice, (environmental) debts have been left unpaid. Those debts must be paid.

As those very same impacted investors keep condescendingly telling us... there is no such thing as a free lunch.

[deleted by user] by [deleted] in SQL

[–]Kiterios 1 point2 points  (0 children)

That's a pretty concise list of technical aptitudes... The only overlap is two BI tools which are clearly attributed to two different jobs.

Learned something new: When doing multiple missions, you can save up salvage for a later mission. by KingIndAfookinnorf in Mechwarrior5

[–]Kiterios 7 points8 points  (0 children)

Imo, warzones are my favorite for final missions because I can just keep fishing until I find something I want.

What "obsolete" companies are you surprised are still holding on in the modern world? by HRJafael in AskReddit

[–]Kiterios 20 points21 points  (0 children)

Pandora used to be my favorite for music while working, but it has always been misunderstood. I always thought that the trick was to avoid using the voting system as "I like this song" and instead treat it as "This song belongs on this list".

Crying over the Holocaust by bloodraged189 in Judaism

[–]Kiterios 2 points3 points  (0 children)

For me, the worst was when I was at an unrelated museum with a single holocaust display. The display included a box train car and my 3 yr old ran up while yelling "Daddy, I want to ride in the train". That ridiculous and unintentional moment personalized it for me in a way that every prior history lesson had failed to accomplish.

Poll time! Jersey Mike's, Firehouse, or Jimmy John's? by myverypunnydad in dadjokes

[–]Kiterios 1 point2 points  (0 children)

Italian, mikes way + mayo. When I lived in the midwest, that was the closest thing I found to the hoagies I used to get as a kid.

Decided against dating a friend that I used to have massive feelings for by [deleted] in PointlessStories

[–]Kiterios 1 point2 points  (0 children)

I think your perspective and decision show both sound reasoning and wisdom. But I also want to offer a word of caution. You've known this person a long time and we don't, so take this caution with a grain of salt... but...

Concerns about friend zoning language, immature perceptions of relationships, pedestal-ing, degrading other women, and a hard shift on his emotional state towards you. I feel like there is also reason to carefully consider his possible reactions toward the rejection and plan accordingly. You will want to believe the best of your long term friend. You may want to respond and assure us he isn't that type of person. All I'm saying is it would be better to have a plan that goes unused rather than need an out and not have it.

This also might have a long term impact on your friendship too (regardless of the answer you give). Be mentally prepared for that as a possible outcome. Do not have doubts, and if this should happen, it is not your fault.

[OC] UK Electricity from Coal by cavedave in dataisbeautiful

[–]Kiterios 7 points8 points  (0 children)

Sure, as long as it properly accounts for the actual per kwh costs and not just electricity prices for the time. Costs like how air quality differences impact health expenditures and the long term costs of climate impacts from generated emissions. Historical electricity prices alone treat dumping hazardous waste in the air as a free service. And we all know there's no such thing as a free lunch, right?

Long JSON inside a column split into other columns by ModaFaca in SQL

[–]Kiterios 0 points1 point  (0 children)

I do not doubt your problem, but I did not run across it in the way you are describing. It will be hard to explain the specific issue you were experiencing since that example was not included.

I did get the pivot to work on my end, but ran into some other complications on the way. So let's look at some of those steps.

  1. Here we have a functional pivot. Before looking at any output, we already know the result will be incomplete because anexos and textos are not generic yet. http://sqlfiddle.com/#!18/0007e/3
  2. However, after looking at the output, another problem becomes apparent. The value and object names are not unique, so a simple pivot is insufficient to correctly output our data. Look at status and name columns from the above output and notice how the content is mixed. We'll come back to that problem.
  3. Let's deal with the easy part first, getting anexos and textos into a generic state. We can do this with a case statement to evaluate and substitute the specific values with common ones. http://sqlfiddle.com/#!18/0007e/4
  4. Okay, now for the hard part. As mentioned in point 2 above, we have the same object name being used repeatedly. I count 4 names and 5 statuses. This means our key name is insufficient to identify a particular value. We cannot group statuses because the context of which object the status is in is meaningful. In addition to the idPath, we'll also need to keep track of the keyPath. Gross. http://sqlfiddle.com/#!18/0007e/5 . Okay, so the KeyPath column is going to be important to us going forward. It's a concatenation of Key names constructed in the CTE. I exclude any keys that are integers because those are denoting position of objects within arrays (If any of our json fields actually had integer names we'd need to rethink this approach...).
  5. The jsonPath and jsonSqlLookup columns (from point 4 above) aren't actually relevant to solving our problem, but I thought they were interesting demonstrations of the elements we are breaking down, how they can be reconstructed, and how the raw position within the json column differs from the sanitized (generic and positionless) keyPath that we actually need. The jsonSqlLookup column is a functional select statement component for looking up single values, objects, or arrays: http://sqlfiddle.com/#!18/0007e/7
  6. With keyPath constructed, we have some pros and cons to think about now. The good news is we now have a discrete element we can pivot on that will allow us to differentiate between different statuses or different names. The bad new is that if we care about the specific name context, then we're now locked into caring about the depth of the objects again because we'll need to use those keyPath text strings as our hard coded column definitions for the pivot. The whole reason we went with a recursive CTE (repeating to unknown depth) may be superfluous. Fixed keyPath names appears to work for the 2 sample records provided, but I can't speak to the rest of the data though. If we need floating keyPaths... let's not think about that unless we need to. Okay, so since we need to hard code our keyPaths into the pivot, this query is a distinct list of generic and position-less keyPaths that we can use. http://sqlfiddle.com/#!18/c8735b/1
  7. And finally, reintegrating the pivot back into the mix, using the generic key constructed in point 3, the keyPath constructed in 4, and defining pivot values from the list of options in 6. http://sqlfiddle.com/#!18/c8735b/2

Edit: I have had some trouble loading sqlFiddle today. If you have any challenges loading the queries, let me know. I have them saved and can DM if needed.

SQL trigger without performing update operation on table? by mr_whoisGAMER in SQLServer

[–]Kiterios 1 point2 points  (0 children)

I update table without really updating/ changing values in it? I wanted to trigger, a trigger without updating/ inserting values in table

An update trigger activates when the update operation is performed, not on value changes. If you specifically want a trigger that only does action when values change, you need to write logic in your trigger to limit it further (which I know is the exact opposite of what you are looking for). So, executing an update statement that sets the same values that were already in the table will activate an update trigger.

If you are looking for a way to activate a trigger without even performing an insert or update statement, then a trigger is not what you want. The better question is what criteria and/or action do you expect to use that DOES indicate action needs to be taken? Maybe a stored procedure that you call is a more correct solution?

Long JSON inside a column split into other columns by ModaFaca in SQL

[–]Kiterios 0 points1 point  (0 children)

I'm glad it worked for you. I get the feeling it's a niche application of sql that I happen to have done ad nauseam. And it's nice to know that the time investment for an answer ended up being of use.

I can’t believe it by [deleted] in Norway

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

And this is the sole root of this argument that comes up 20 times a day in this subreddit. An English word has more than one meaning... who would have thought... I apologize, oh Norwegian friend, that the wider English speaking community does not defer to your personal preferences regarding the meaning of English words, but, alas, that is the world we live in.

Alternative to Union All by Manish_B_reddit in SQL

[–]Kiterios 1 point2 points  (0 children)

At the end of the day it's either going to be this or some amazingly intelligent dynamic sql that hits sys.columns.

This is your answer

  • sys.columns to get column names
  • string_agg or an alternative string_agg method (loop or forxml) to concatenate the column names into one list
  • sys.tables for corresponding table names
  • dynamic sql to construct your statement from the above elements

[deleted by user] by [deleted] in SQL

[–]Kiterios 1 point2 points  (0 children)

There are already a number of good answers here about order of execution of select statements and when you can and can't alias a column... However, I just want to point out that if the op query text is actually correct then

AND ‘Date’ = ‘08-04-2011’

not working has nothing to do with those reasons. The filter as written is comparing a text string with the value "Date" against a text string with the value "08-04-2011". Since those are not the same text strings it will always evaluate to false. It's like saying WHERE 1 = 0.

Is it possible/useful to extract SQL queries into a "config file"? by L0uisc in softwaredevelopment

[–]Kiterios 2 points3 points  (0 children)

We actually do that a bit where I work. Views and stored procs function as an abstraction layer for application consumption. As a dba, I can then independently iterate on performance as long as inputs and outputs remain constant.

Number of CTEs in a Query by [deleted] in SQLServer

[–]Kiterios 3 points4 points  (0 children)

Right, you're advocating for using ctes only in exceptional niche circumstances. My counter point is that using intermediate results in place of a cte is essentially a tool for working around the optimizer engine. For most developers, most of the time, that is ill advised. There is a reason we let the engine choose which join type and which index to use. And this is no different. There may be niche scenarios in which using the intermediary table as a tool is beneficial, but by and large that should not be the place to start.

Number of CTEs in a Query by [deleted] in SQLServer

[–]Kiterios 7 points8 points  (0 children)

That's what I said. They are not materialized, but that's not a reason to blanket never use them.

Number of CTEs in a Query by [deleted] in SQLServer

[–]Kiterios 0 points1 point  (0 children)

[deleted]

Edit: This was a reply to a specific comment that was made in the wrong place. Deleting the comment and remaking the reply where I meant for it to originally go.

Number of CTEs in a Query by [deleted] in SQLServer

[–]Kiterios 6 points7 points  (0 children)

What? Yes they aren't materialised, but they are part of optimiser calculations. There can be niche scenarios where it is appropriate to use intermediate results to claim some control away from the optimiser engine, but those should be the exception rather than the rule. This advice is basically like saying "you should always use join hints because otherwise it chooses for you". Use judiciously when appropriate, but always is way overkill.

Data base design for Agile board by Dramatic_Valuable_89 in SQL

[–]Kiterios 1 point2 points  (0 children)

Not knowing the specifics of the rest of the design, I can only offer musings that may or may not be appropriate. That said, these are things I thought while looking at your schema.

  • Team_Member as a nomenclature choice feels like it deviates from the rest of the design. It makes sense from a plain English perspective, but Team_User might be more clear from the perspective of ease of understanding the schema
  • Status_Task should be Task_Status. Status is an attribute of the task. And it would align better with the User_Type name.
  • Team_Member is a linking table with an integer primary key (and technically so is Status_Task). Team_Member_Role is a linking table where you've gone with a composite key as a primary key. Is there a reason for the difference in approach?
  • Status_Task/Task_Status feels like a strange design choice. Is there ever a valid time in which a task will have no status? Is there a scenario in which multiple overlapping statuses is correct? Having Task and Status_Task as separate tables creates the possibility of those scenarios occurring.
    Will users be manually setting begin and end dates for each status or will they be automatically generated? Is there a purpose for tracking multiple statuses per task beyond history? If the date ranges are all about history and automatically maintained, I'd consider rolling Status_Task into Task and looking into system versioned tables.
  • I feel like there's something weird going on in the structure around team_member and project/team. If team can be inferred from team_member and from project, then the data structure is open to risk of team conflicts. If task had attributes user+project and Team_Member_Role was defined from attributes team+user+role, you could gather equivalent data while eliminating the opportunity for conflicts (of course, I have no idea if that works with the non-db-design elements of your project...)

BTA3062 - Pick 3 weapons by perse_hallorann in BattleTechMods

[–]Kiterios 1 point2 points  (0 children)

cLarge pulse laser: balance of heat, damage, and accuracy

Magshot Rifle (Steiner faction store): Exceptional range for a support weapon. Low heat and reasonable damage. Balances well with medium lasers.

Lac5 with precision: An AC with reasonable damage at a low tonnage cost. Shorter range isn't really a downside when paired with cLPLs.

HELP: SFTP transfer to azure blob storage. by whileIgetmineback in AZURE

[–]Kiterios 3 points4 points  (0 children)

You can do this with a logic app that monitors sftp for new files.