Questions tagged as 'sql'

2
answers

How to calculate average hours?

I have a table named visitantes in it I enter the hora_que_entrou and hora_que_saiu of my user on my site. These are in DATETIME format. I would like to run the average that they spent online, is it possible wit...
asked by 26.12.2014 / 20:27
1
answer

Problem with condition in SQL query

I have a query that looks for information from two different tables, with two conditions. Apparently it worked fine, but when the a.vendedor field is empty, the result is null. I understand that the result should be the same, but I wou...
asked by 29.01.2015 / 10:57
1
answer

PostgreSQL Unilateral Replication

I have two servers. One is solely for testing purposes. The other is for production itself. I need the test database to contain the same data as the production database. I can not do a mirroring, since if I do this, changes to the test server wi...
asked by 30.01.2015 / 20:09
1
answer

SQL query grouping by age group

Hello, I need a way to do an sql query that will bring me the amount of male and female people. NOTE: I have two tables where the first one is registered in it I have the sex column and another table that would be entered only with the addressna...
asked by 02.09.2015 / 15:56
1
answer

Order by SQL Server in Procedure

Hello, I am in the following situation: I need to select the amount of care of people of some age groups and of those who are male and female. I have the following tables: cadastro (id, natendimento, data, sexo, fokfaixaetaria) and fa...
asked by 02.09.2015 / 21:31
2
answers

Find and replace before and after using an sql joker

I have a list of over 5000 letters with different names and a - (hyphen) in common. Example: Evilswarm Exciton Knight LVAL-EN056 Number 101: Silent Honor ARK LVAL-E47 Number 11: Big Eye GAV-EN090 Lavalval Chain HA07-EN019 Wh...
asked by 31.03.2014 / 20:03
1
answer

LIKE query in related table

I have a query that does the search for TECHNICAL CALLS and in this research I make some JOINS to bring related information. I need LIKE to also work for the CLIENT name (which is in another table) The query I have is this: SELECT *,...
asked by 27.03.2014 / 20:43
1
answer

Insert with three tables in MySQL with PHP

For purposes of study and testing, I have created three tables in phpMyAdmin: People , Contact , CredentialsLogin . The Contact tables and CredentialsLogin are related to People. The goal is to perform the insertion of records for the thre...
asked by 02.01.2019 / 20:13
1
answer

Change method using Java and SQL

I need to make a change in SQL using Java, but I ended up losing my logic when calling and returning to change. Here's the code outline. Here is Main , where the user informs the CPF that he wants to change: static private void altera...
asked by 23.05.2014 / 13:22
2
answers

UPDATE only on last inserted rows

I'm importing some Excel spreadsheets via ETL into a relational database. The problem is that for me to be able to perform the relationship of the tables, I am using queries for the insertion of the foreign keys. But as the bank grows, these que...
asked by 11.11.2018 / 05:10