r/SQL • • Oct 01 '26

Discussion How is sql approach in the practise/real life?

I am corious that how the people use it real life for instance in a manufacturer company.

0 Upvotes

11 comments sorted by

7

u/tordj Oct 01 '26

In manufacturing, you record an enormous amount of data about the processes and the materials used. If you record structured data, you use sql for analysis.

2

u/DarlanSandro Oct 01 '26

Bem, na vida real, o SQL é o motor invisível por trás dos sistemas operacionais de uma empresa, como ERPs (sistemas de gestão integrada) e MES (sistemas de execução de manufatura). Quase ninguém fica rodando consultas soltas sem um objetivo de negócio claro. Em uma indústria, ele é usado para cruzar dados de compras, estoque, linhas de montagem e expedição.

Um dos usos mais críticos em chão de fábrica é o rastreamento de lotes e controle de qualidade. Se um lote de matéria-prima de um fornecedor for identificado com defeito, a fábrica precisa agir rápido. Com SQL, você cruza a tabela de recebimento de materiais com as ordens de produção e os números de série gerados. Em segundos, a equipe descobre exatamente quais produtos acabados usaram aquela peça defeituosa, em qual data foram montados e se já foram enviados para clientes ou filiais.

Outro caso diário é o planejamento de produção e estoque (conhecido como lista de materiais ou BOM). Para montar 500 unidades de um equipamento na próxima semana, o sistema roda consultas agregando o estoque físico atual de cada componente, os pedidos de compra que ainda vão chegar dos fornecedores e a demanda das ordens de venda. O SQL calcula o saldo líquido disponível e aponta com precisão o que vai faltar antes que a linha de montagem seja obrigada a parar.

Na própria linha de produção, máquinas e operadores registram apontamentos contínuos: horários de início e fim de lote, paradas para manutenção, trocas de ferramentas e peças com avaria. Consultas SQL agrupam esses registros por turno, linha e operador para calcular indicadores industriais (como disponibilidade de maquinário, refugo e produtividade por hora).

No dia a dia, a maioria dessas consultas não é digitada manualmente pelo operador. Os analistas e engenheiros escrevem o SQL para estruturar views, procedures e rotinas automáticas que alimentam relatórios programados ou painéis em tempo real espalhados pelas telas da fábrica.

1

u/Infini-Bus Oct 01 '26 edited Oct 01 '26

 I work on a team that primarily supports our clients that use a part of our 30 year old software suite for tracking occupational licenses.   

There is a transaction engine that tracks people applying for, renewing, and maintaining licenses that the industry uses.  Then there is a separate more database product that the government regulators use to track the compliance for individuals and organizations.  The transactions feed into the databasing product.

Support analysts use SQL to investigate issues that occur due to imported bad data, human error, software bugs, among other things.  They do simpler queries and low impact updates.  If they stick around they are good candidates for a promotion to a BA.

Business analysts will use it to do some data analysis and to examine and update configuration and business rule tables that dictate how the software works.  Then determine what needs to change in the database in order to implement changes to the data or configuration to make the software behave according to the law in a given jurisdiction.  I.e. when a license expires and what happens when it does.  

Technical Consultants will write or QA more complicated adhoc reports that the software can't do, larger and more complicated PL/SQL data updates as part of a project a BA is working on like a data conversion or migration due to a change in the law or a customer signs a new contract or leaves us.  They also assist on support issues for a support analysts - like a bug that caused a bunch of records to get messed up. Anything that isnt an update, insert, delete, or select is handled by a team of DBAs such as monitoring for performance, making schema changes, restoring backups, etc.

1

u/phunkmunkie Oct 01 '26

Anyplace you need to maintain persistent data and make it available to reports or other applications…. Database.

1

u/Unique-Quiet-4412 Oct 02 '26

Good point. Real world examples from manufacturing would be really helpful.

1

u/Acceptable-Sense4601 Oct 06 '26

SQL is great, especially when you use it outside of the typical database and use it on CSV files with DuckDB

3

u/[deleted] Oct 01 '26

[removed] — view removed comment

2

u/uncertainschrodinger Oct 01 '26

I'm curious why manufacturing firms haven't adopted more "modern" pipeline tools

1

u/philbgarner Oct 01 '26

In my experience, they are, but only in specific areas that would immediately benefit from a more sophisticated (or sometimes, politics: who gets the new shiny?).

The rest of the company is served by older tech that was written several years (or more) ago and it just works, so don't mess with it!

I've found there's only really appetite for modernizing when it would mean production (or whichever part of the manufacturing process) realizes real improvements from it.

Otherwise, it's working! Don't touch it!

There is a lot of inertia and it can be hard for us devs to advocate for the change we need, but I understand why it's that way.

2

u/uncertainschrodinger Oct 01 '26

hmm that makes sense, classic no need to fix it if it's not broken

I had a similar experience working at larger infrastructure companies, but when I was able to circumvent IT's red tape and actually show the team how much easier, faster, cheaper it is to use new tools, they would then go and advocate on our behalf. Turns out it's easy to ignore the data team, but harder to say no to a VP of operations/finance.