Questions tagged as 'mysql'

2
answers

Database model optimization

I'm making a system for a college and one of the subsystems I'm building is the student newsletter. I put it to when creating a new discipline in the table "discipline" this discipline is added to the "notes" table with a record for each id of e...
asked by 08.10.2017 / 19:11
1
answer

Column index query of type JSON

How do I perform a query, by index, where column data is of type JSON? For example: I want to get all the data where the voltage is equal to 220: table material id | descricao | extra 2 | Altus | {"tensao": "220", "comuni...
asked by 19.10.2017 / 20:18
1
answer

Table with Compound Key without repeating

How do I make a table with a compound key, but I can not repeat the combination of values. I want to store FRIENDS , using a syntax similar to this: tb_amizades id_usuario_um id_usuario_dois SELECT * FROM tb_amizades WHERE id_...
asked by 30.10.2017 / 15:10
2
answers

Consultations in Laravel

I'm trying to run a query in Laravel , the terminal works perfectly, but when I enter in Laravel , it returns me empty, eg: Query: SELECT MAX(positions.id), devices.name, positions.deviceid, positions.ser...
asked by 07.03.2018 / 19:13
2
answers

Login system with permission

I have a login system that, if the user is an administrator, will be redirected to one page and if it is common, for another. The table: To do this, I have a column in the table that stores active call users, where 0 is a regular user an...
asked by 25.09.2017 / 13:28
1
answer

How to use pagination with Laravel DB :: select?

   testController.php $jogos = DB::select("select * from jogo where id_u ='$id_u'"); This is the code I want to page in View using blade    jogo.blade.php {!! $jogos->links() !!} $jogos = DB::select("select * from j...
asked by 27.09.2017 / 01:42
2
answers

Query with join

I have a problem in the query to generate a report. I made a JOIN of the ordering table (which will get the report) with the table of customers and products. Until then everything worked, but he hardly shows all the requests, only shows the firs...
asked by 17.11.2017 / 12:58
2
answers

Help to simplify query sql query

I have a huge sql query: select l.no_cidadao, extract(year from l.dt_cad_individual) ano, extract(month from l.dt_cad_individual) mes, date_part('year',age(now(), l.dt_cad_individual)) diferenca from tb_unidade_saude p, tb_cds_cidadao_resposta...
asked by 09.03.2018 / 13:20
2
answers

censor a word registered in a database

Is there a way to censor and replace a MySQL registered word with a procedure or trigger for example? The word in the case would be Flash House and need to be replaced by Old School .     
asked by 05.09.2017 / 03:52
2
answers

COUNT on multiple tables

I have two tables in my system, and I need to do a two-column count on the tables. I currently do through a VIEW as follows: CREATE VIEW totais AS (SELECT (SELECT COUNT(publications.id) FROM publications) AS total1, (SELECT COUNT(deejays.id) F...
asked by 01.09.2017 / 17:15