Questions tagged as 'sql'

1
answer

Select fields from another table with multiple foreign keys

I have 4 tables: Lojas(nomeLoja, *IDloja*, morada, telefone, email) Bancos(nomeBanco, *IDbanco*, morada) PlanoContas(*conta*, descricao) Gestao(NIB, nConta, conta1, conta2, IDloja, IDbanco, *IDgestao*) conta1 and conta2 are...
asked by 13.05.2014 / 18:16
1
answer

Why does the SQL language vary from DBMS to DBMS?

I was used to using SQL for web projects, always using MySQL. One day I had to write a C ++ program that used databases. At first I chose SQLite but needed other computers on the network to connect to the database. So I opted for PostgreSQ...
asked by 29.08.2018 / 20:37
1
answer

SQL using an Array of words

This is the following I have a search field on a form where the user types for example a color or product and is returned to it a list of products with the characteristics typed in the form, the problem and the following, when I pass the array i...
asked by 23.12.2014 / 14:51
3
answers

Line with NULL value is disregarded by SUM function?

I participated in the IFNMG competition, a test prepared by the CEFET Foundation. I solved the following question and I marked the letter C, but the template says that the correct one is the letter A. Question 31 Note that the NotaFiscalIte...
asked by 17.12.2018 / 18:07
2
answers

Is a View faster than a regular Query?

When I use a query of type SELECT * FROM myView is faster than SELECT * FROM (query para gerar a view acima) I have a query and I would like to cache it or make it faster, but I am in doubt if I create with View or Query !     
asked by 17.10.2017 / 04:51
3
answers

How to know which DATETIME format used in a particular SQL Server column?

I have a table in SQL Server and one of the fields was created as DATETIME . As I can tell, via query or SQL Server Studio , what is the default format used of this DATETIME in my SQL Server ?     
asked by 15.04.2015 / 14:11
2
answers

Have images in the tables where they will be used or table with repository of images?

Is it a good practice to create a table to record all the images in a database, or can I create the columns that save the image information for each specific need? For example, let's suppose I want to create a table for categories of a websit...
asked by 25.10.2015 / 16:04
1
answer

Sql - Select first and last record

I have the following tables: CREATE TABLE tb_lote ( id_lote integer NOT NULL DEFAULT nextval('tb_lote_seq'::regclass), ds_lote character varying(255), CONSTRAINT pktb_lote PRIMARY KEY (id_lote) ); CREATE TABLE tb_lote_ticket ( id_lote...
asked by 02.10.2015 / 17:09
2
answers

Is it redundant to use LIMIT in a QUERY whose ID is a primary key?

My question is if using LIMIT will there be some performance gain in QUERY . Example: SELECT descricao FROM produto WHERE id = 9999 LIMIT 1 Has better performance than? SELECT descricao FROM produto WHERE id = 9999...
asked by 17.05.2015 / 01:57
1
answer

Firebird SQL and Union ALL without Duplicating Items

I have a SQL query that searches two tables for a primary and one for history but when I run the query the values come duplicated I use UNION All because if I by UNION or DISTINCT displays the following message:   ...
asked by 26.10.2017 / 19:12