Questions tagged as 'sql'

2
answers

Regular expression with termination specifies to bring 3 first characters

I'm trying to do a regular expression in Oracle with the following requirement: Finish with a specific letter, if you have that letter in the middle do not search. Return the first 3 digits of the string. To solve the first problem I ca...
asked by 15.03.2017 / 14:04
1
answer

Sql group records

I have the following query: select T1.dt_producao, T1.cod_turno, T1.cod_periodo, CASE WHEN T2.TP_PALLET = 'DZ' THEN sum(T1.QT_PROD* T2.QT_EMBALAGEM*12) ELSE sum(T1.QT_PROD* T2.QT_EMBALAGEM) END AS "APON.TOTAL", (...
asked by 05.10.2016 / 16:20
1
answer

How to pass an array in a WHERE condition

$this->db->set('al_reg', $matricula); $this->db->set('dataagendamento', $dataagendamento); $this->db->where('cod_lab', $laboratorio); $this->db->where('cod_horario', $horario_prova); $this->db->where('cod_data', $dat...
asked by 18.10.2016 / 15:31
2
answers

I need a new random number for each line in a sql query (server)

I use the sql server . I need to use a random number in several different columns (the same random number) but I want a new random number on each line ... For example, let's assume that TABELAX has only 5 rows and I'll query the genre ......
asked by 16.11.2016 / 11:43
1
answer

How can I get the DB date already formatted using the Max and Date_Format Joints

I'm trying to get the longest date entered in my BD , I'm trying to use the MAX and DATE_FORMAT functions together and the search result is not as expected, I have these dates registered: 2016-10-24 2016-10-25 2016-10-26 2016-10-27 2016...
asked by 08.11.2016 / 18:01
2
answers

Get data from another table in mysql and quantity

I have a lot of questions about MySQL when I have to use INNER JOIN to get data from other tables. I have 3 tables: MEDIA id, user_id, title, description COMMENTS id, user_id, media_id, comment MEDIA_LIKES id,...
asked by 11.09.2016 / 01:32
1
answer

md5 Encryption PostgreSQL

I am creating a table using PostgreSql and in it there will be a password field with MD5 encryption. How would the syntax be in it? Because I have more contact with MySQL than PostgreSQL.     
asked by 04.11.2018 / 21:59
1
answer

Execute procedure oracle

I created this procedure but I can not execute it. I have the following error when trying Execute:    PLS-00306: Incorrect number of argument types in call to 'SP_CARTAO' CREATE OR REPLACE PROCEDURE SP_CARTAO ( P_ID IN INT , P_ID_CAR...
asked by 01.12.2014 / 22:14
1
answer

How to model a set of 1 to 4 default values

I'm modeling a MySQL database where key entities are documents. Among several other fields, these documents relate to one or more phases of a given project. There are 4 basic values (let's call them A, B, C and D), and the phase property...
asked by 19.11.2015 / 20:03
2
answers

How to make a select from a Night time period (6:00 pm to 6:00 p.m.)

Description: Count how many times the action occurred in the night time considering the time from 6:00 p.m. to 6:00 p.m. There is a better way to do such a select without having to use or to compare the periods? select count(*) as contado...
asked by 03.03.2015 / 15:14