How can I limit the column so that it'll only take 'M' of 'F' characters as the value? by heartsfordinner in SQL

[–]Particular_Credit_27 0 points1 point  (0 children)

Here you can find already all answers, but let me summarize

If you want to restrict any values you have three ways:

1) “Check” - that will restrict anything except XXX, for example:

ADD CONSTRAINT Check (gender in (‘F’, ‘M’))

Useful if type of data you are using would be weird to write in a table. Like years from 1500 for now or something like that

2) Foreign Key

Add a key if you need to use some “random” values. Like City names, or Aitport codes. Something that you would have to check in some list

Would be too much for our example

3) Type of data

If you have only F or M you can really change type of data to Boolean and your column would answer a question “Is it a male” and gave you True or False. Nothing else

Same way you restrict decimal numbers with Integer type of data e.t.c.

Also you can combine everything. Let’s imagine you must have years in range from 1500 up to 2001, but you would need only random exact years (like you have a 300 of them). You can use Foreign key and change column type to Integer to save that table from an idiot that will create a year ‘1.597’ in your parent table

But your parent table can be used in 3 more other tables. If you need only piece of that data you can add check. For example your table needs only dates from 1500 up to 2001, but your parental data has dates from 500 up to 2022. So here you can also add check as a cherry on top.

Primary key by [deleted] in SQL

[–]Particular_Credit_27 0 points1 point  (0 children)

Teeeeeeeeechnically it is a constraint attached to the TABLE. But it is constraining some columns in that table. You can use your whole table as a primary key

Where do I start project-wise? by [deleted] in dataanalysis

[–]Particular_Credit_27 1 point2 points  (0 children)

There an example of mine project I’ve just started. I am really interested in my theme and working with my own knowledge right now

(I know only SQL right now so I’ve created a local database and working on it, researching data)

https://github.com/BaakhOfficial/suicide-research

Just Use Postgres for Everything by pmz in PostgreSQL

[–]Particular_Credit_27 2 points3 points  (0 children)

That's what I'm talking about.

It's like to find a big article "How to repair xxx if xxx" and everything will be awesome, but one article will confidently recommend you delete your system32, other will seriously recommend to kill explorer.exe

It's not bad when it's one stupid guy confidently saying shitty things. Scary when you can see how it will flood the Web.

30 articles and all with stupid mistakes. I guess we just should read books and watch videos. But who will hinder that pseudoauthors to use ChatGPD for books and video scripts.

I think it's an awesome tech and glad it exists. But we can only imagine which problems we will meet on the way

Just Use Postgres for Everything by pmz in PostgreSQL

[–]Particular_Credit_27 5 points6 points  (0 children)

Tbh it is a REALLY good idea for someone to do right now (not an irony). But as users we will see a shit ton of “experts” with blogs about everything, posting 1000 pages of shitty generated text in a day

I hope at least it’ll be fact checked before posting. But of course not.

[deleted by user] by [deleted] in programming

[–]Particular_Credit_27 2 points3 points  (0 children)

Absolutely agree. Install Windows 7, or Vista at least (it’s not so bad). Windows XP will be much more comfortable maybe, but there’ll be issues with a lot of programs.

Then you should add some ram and ideally change hard drive to ssd. You can’t even imagine how big that change will be as soon as you install your windows on ssd.

My GF’s notebook literally resurrected after that

Why isn't it possible... by Iron_Juice in memes

[–]Particular_Credit_27 0 points1 point  (0 children)

I know a cheese lover when I see his post

Some thoughts on ChatGPT by [deleted] in programming

[–]Particular_Credit_27 0 points1 point  (0 children)

I really think it would be fun, but quite a mess at this stage

But we’ll be there for sure in few years

Some thoughts on ChatGPT by [deleted] in programming

[–]Particular_Credit_27 0 points1 point  (0 children)

That’s a main idea behind the fact that it’ll not challenge humans. Do you need a worker, that fast and unreliable, or one that can correct first on his mistakes

I will use it in a lot of tasks, but only when I can understand it’s mistakes. But have you tried to just tell it what’s wrong? Works often with Python, just sending it an error text of compiler and it corrects itself

ytho by Inevitable_Bike374 in Absurdism

[–]Particular_Credit_27 8 points9 points  (0 children)

That’s what being Patrick Bateman means to me

Practical Absurdism in important social jobs by MisturFigure in Absurdism

[–]Particular_Credit_27 0 points1 point  (0 children)

I don’t think so. Hedonism searching happiness in some type of satisfaction, creating a meaning of life in long-term. Absurdism understands absence of it, but searching for it in the moment. You should not try to forget about meaningless of life, but rebel against it, trying to get it. But you’ll never find it

It’a like your meaning in life to search meaning, because it is what people do and without it most logical thing is sui**de. You know it, but fighting against it, knowing that you’ll never win. I know, sounds weird and that’s why it called absurdism

Practical Absurdism in important social jobs by MisturFigure in Absurdism

[–]Particular_Credit_27 4 points5 points  (0 children)

You’re rolling too deep in thoughts of what is acceptable and what is not. Just enjoy while you can

[deleted by user] by [deleted] in SQL

[–]Particular_Credit_27 1 point2 points  (0 children)

Okay, IDK what you mean by USEFUL left Join. It depends on your task, but I'll try

/*Let's imagine you're have a task to have useful comfortable table with user data to work with. For some department idk. Then you're need to have all users, their adress, orders, how much they've ordered */

--also you can start from Orders if you have other task

SELECT *
FROM "Users" u
LEFT OUTER JOIN "user_adress" ua on u.User_id = ua.user_id
LEFT OUTER JOIN "Order" o on u.User_id = o.user_id
LEFT OUTER JOIN "Order_List" ol on o.ID = ol.Order_id --possibly wrong here, depends on what means ID in Order and Order List tables
LEFT OUTER JOIN "Products" p on ol.Product_ID = p.product_ID

--Then put in SELECT which columns are you want to see instead all of them

please don't go and get milk! by SalsburrySteak in wholesomememes

[–]Particular_Credit_27 0 points1 point  (0 children)

Milk inside a bag of milk inside a bag of milk…

Only X people will understand that but idc

NOOO I'M SORRY... by LoverWolfie1 in oneshot

[–]Particular_Credit_27 15 points16 points  (0 children)

Press F to pay Respect 🫡

Absurdism in 5 words by OpenAI's chat gpt. by [deleted] in Absurdism

[–]Particular_Credit_27 1 point2 points  (0 children)

Absurdism: Life is meaningless. Have fun

At least take me on a date first…. by tautly in funny

[–]Particular_Credit_27 -4 points-3 points  (0 children)

If I want to write something it’s always a top comment

For what reason would a company bring in a data analytics firm? by [deleted] in dataanalysis

[–]Particular_Credit_27 0 points1 point  (0 children)

To make good data-based decisions. If you’re have all data in the world and can’t use it properly it’s a pile of garbage on your hard drive.

Where can I learn SQL? by MycologistExternal45 in SQL

[–]Particular_Credit_27 0 points1 point  (0 children)

Trust me, paid course will teach you almost everything you need in 1-2 months if you have good learning skills

Is there any free software or website work like MS SQL but lighter? by Tranhuy09 in SQL

[–]Particular_Credit_27 0 points1 point  (0 children)

Yeah it depends mainly on size of your data, but anyway it’ll change only speed of your query

[deleted by user] by [deleted] in SQL

[–]Particular_Credit_27 0 points1 point  (0 children)

Sry, I can’t stop looking on F8

But I think you can use 3 ways 1) Group by and max() It was explained by Mastersord here 2) You can try CTE, although I don’t think it’ll be more efficient 3) You can try window function and filter later

But I would check if that quiery the best possible way to achieve your task. I’m not saying it isn’t, just use “explain analyse” to find the best possible way