Questions tagged as 'sql'

1
answer

Use a ResultSet in java to print a whole table on the screen

I know that with resultSet we can do several things with a SELECT done in some table. For example: I know we can get a table and print its contents, listing which columns we want with methods like: getString and getInt. Conection con = ..........
asked by 30.01.2018 / 00:22
1
answer

how to do a query by ordering a rising column and a descending column

I need to do a query that looks for a growing column and in the same query another column in descending for example in the result below: item | quantidade carro | 400 carro | 340 dado | 240 disco | 180 disco | 120 faca...
asked by 25.04.2018 / 12:40
1
answer

How to compare two fields of identical values but different size?

I have a database where you have fields of the same name but with different sizes I need to choose the field with the largest VARCHAR. How can I do this?     
asked by 19.01.2018 / 15:13
2
answers

sql file or direct to the database

Today a question arose to me, I was creating a table in the database and I came across whether I should do this manually, directly in the database or create this table through queries, creating a .sql page. What would be best and safest?...
asked by 13.12.2017 / 01:22
1
answer

How to remove a SQL Server constraint

I'm having a problem removing a constraint from a table. Purpose is to exclude the constraint to delete a table. The problem is: I have a Yield table that is associated with Extra Yield. This Yield table is FK_COD_RENDA_EXTRA. ALTER TAB...
asked by 26.12.2017 / 18:13
1
answer

"min ()" with two parameters

The person who worked before me at the company made this code: MIN(DATEPART('weekday',[Entrega Data Real]),6) What does this 6 mean? Can min() have two parameters?     
asked by 26.12.2017 / 14:04
1
answer

Create select for a table in PHP

I'm having trouble creating select for later use in a table. The required SQL tables are as follows: “Aluno” (**PK:** id, numero, nome), “Area” (**PK:** id, nome), “UC” (**PK:** id, nome, **FK:** id_area) “Classificacao” (...
asked by 10.12.2017 / 22:52
2
answers

Select all customers and check if you are carrier and supplier

I want to make a select that selects all the clients and next to it create two columns a carrier call and another provider and in each of them to mark yes or no. Ex: Código Nome Fornecedor Transportadora 01 João Sim...
asked by 06.09.2018 / 22:35
1
answer

Create new table from another in sql server

I'm doing this query : CREATE TABLE nova_tabela AS SELECT * FROM tabela_copiada; I'm getting the following error :    Incorrect syntax near the keyword 'SELECT' I already searched the syntax and I think it is correct. Can anyone he...
asked by 09.01.2018 / 19:34
1
answer

Pick up sales media for a given month

I would like to take the average sales of the month by product description and not date by day, month and year, but I do not know how to get it. SELECT AVG(vend_qtde) AS qtde_vendas from tb_vendas WHERE esto_descricao like '% Saco pedra %' and...
asked by 04.01.2018 / 22:56