Questions tagged as 'sql'

3
answers

How is the join and WHERE with multiple tables made?

I have 4 tables they already have foreign key. aluno: id matricula username curso_id // referencia a id_cursos da tabela cursos, coluna id_cursos. cursos: id_cursos nome_cursos modulos: id_modulos nome_modulos cursos_id...
asked by 04.11.2017 / 14:57
2
answers

How to get value from a database column using C #

I have a web application that uses these 3 tables: Client: CREATE TABLE CLIENTE( ID_CLIENTE INT PRIMARY KEY, CLIENTE VARCHAR(50), ENDERECO VARCHAR(50), CIDADE VARCHAR(30), CEP VARCHAR(9), UF CHAR(2) ); Order: CREATE TABLE PEDIDO (...
asked by 02.12.2017 / 15:13
2
answers

How to insert sequence in non-self-incrementing field

I need to insert records into one table with data from another by continuing the sequence of a column that already exists in it, but the column I want to continue the sequence is not self-incrementing and the table does not have a primary key....
asked by 21.11.2017 / 14:12
3
answers

Use prepare statement in a constant value?

$type = 'post'; $stmtPG = $conn->prepare("SELECT count(*) FROM myTable WHERE entry_type = :type"); $stmtPG->bindParam(':type', $type); $stmtPG->execute(); $total = $stmtPG->fetchColumn(); $total_paginas = ceil($total/$maximo); Ther...
asked by 24.09.2018 / 17:24
1
answer

COUNT (*) x COUNT (1) x COUNT (id)

I would like to better understand the difference between these ways of using the counter: select COUNT(*) from tabela select COUNT(1) from tabela select COUNT(id) from tabela This question deals with performance between two ways, but wo...
asked by 17.09.2018 / 14:15
1
answer

Is it possible to place an HMTL file inside the database?

Is it possible to save an HTML file to a BLOB column within the database and then display it as part of the page in PHP? Why do this: It's more for a learning experiment to compare if it gets better than a include on the page....
asked by 26.10.2018 / 23:22
1
answer

Is it necessary to relate the tables to a database?

I have a little knowledge about the database and I know how to use JOIN for certain SELECT s. I'm setting up a simple DB where I have absolute assurance that one table has no relation to another. Is required? Is there anything in...
asked by 26.09.2018 / 22:10
1
answer

Column for MySql row

I have the following table: | Roll No | Student Name | Q1 | Q2 | Q3 | |--------------|--------------|--------|------|------| | 1 | Aluno 1 | 1 | 1 | 1 | | 2 | Aluno 2 |...
asked by 07.10.2018 / 01:12
3
answers

Select the two largest values of a tuple

I have a query that displays the following result: ID | v1 | v2 | v3 | 54384 | 2.4 | 8 | 2.55 | 54385 | 5.6 | 1 | 3.24 | How to do, in a SELECT , the selection of only the two largest values between the "v1", "v2" and "v3" fie...
asked by 10.12.2014 / 18:02
1
answer

Select, by quantity, items that match conditions

I'm having a question when setting up a query. I'll set up a fictional scenario to demonstrate. I have the quantidadeQuestoes table with the fields: cod_level cod_category cod_dificulty quantity And I have the questo...
asked by 11.08.2015 / 19:33