Questions tagged as 'sql'

2
answers

Count occurrences followed by a value in a table

Hello, I have a table that has a value ID and other values among which is nombre . ############### # ID # Nombre # ############### # 4 # Juan # ############### # 3 # Juan # ############### # 2 # Juan # ############### # 1...
asked by 17.03.2017 / 05:51
3
answers

PL / SQL SMTP: 501 Error: attribute value too long

I am presented with an error when creating an automatic email through the database, I am creating the body and I get this error message:    ORA-29279: Permanent SMTP error: 501 Error: attribute value too long       ORA-06512: in "SYS.UTL_SMT...
asked by 11.02.2016 / 20:45
1
answer

fetchColumn vs. columnCount

colsulta SELECT that a single record should return if it exists, what's valid with if ($stmtStore->fetchColumn ()==0){...} and the redultado is true and the valid one with if ($stmtStore->columnCount ()=...
asked by 01.12.2018 / 02:04
1
answer

How to perform a query on mysql using count?

I can not perform the query that returns me the number of municipalities of the reports, example: |municipio | cantidad | |----------|----------| |ACAJETE | 4 | |PANTEPEC | 5 | |PUEBLA | 1 | In the report table: t...
asked by 07.11.2018 / 00:56
1
answer

How can I create a query that subtracts a certain percentage?

I have a table with a certain amount of price according to each article, I would like to know how I can subtract a percentage from the price, for example 30%.     
asked by 15.11.2018 / 01:35
1
answer

Trigger to auto-insert values in a table

I'm new to projecting databases. I have 3 tables: users: +--------+--------+---------+----------+--------+ | userid | name | surname | password | admin | +--------+--------+---------+----------+--------+ | value1 | value2 | value3...
asked by 18.11.2018 / 18:49
1
answer

Custom SQL Server Audit Table

I need to make a trigger, that I insert in an audit table, the name of the table, the date and the type of action that is performed, this trigger must be executed at the database level after an UPDATE, INSERT or DELETE of any of the tables in th...
asked by 27.10.2018 / 20:36
1
answer

Change null values to '0' in a SQL pivot

I have something more or less like that select * from( selcect ...)as pt pivot( asc(valor) for desc in ( [Deporte y cultura],[Despensa],[Destajo - sueldo], [Destajos], etc ...) ) as pvt So far so good, but I get many results as null from...
asked by 19.09.2018 / 18:59
2
answers

Link several tables to another to obtain groups of records

A few weeks ago I created a database to use it in my Android app. It turns out that these two weeks I've been thinking about a problem I had, and no matter how many solutions I got, they gave me errors and I do not know what to do anymore. I'...
asked by 03.06.2016 / 15:33
1
answer

Double reference to a MySQL table

I have a database in which the data of students who have passed from the baccalaureate to the university are stored, now the school has 5 seats and it is the case that young people who studied in a seat, are currently reporting or attending trai...
asked by 03.08.2018 / 03:06