Most voted "sql" questions
Structured Query Language (SQL) is a language to query databases. Questions should include examples of table code and structure. This tag refers to the default language, not to be used for questions about the implementation of specific DBMS (such as Mysql, Postgresql, Oracle, MS SQL Server). In this case use the specific DBMS tag. Answers to questions marked with ANSI SQL should use SQL as much as possible.
Learn more…6,771 questions
Sort by count of
-
-1
votes2
answers2237
viewsPHP insert a data array into a mysql table
I have an array in php that contains some data, example: Array ( [nome] => Nome [sobrenome] => Sobrenome [genero] => 1 [email] => [email protected] ) And I would like to insert this data…
-
-1
votes2
answers543
viewsAssign value to SQL variable
How do I make one select which assigns the value "10" in all of the games column? Note: Without giving update on the table. /*minha_tabela*/ codigo jogos --------------------- 1 10 2 10 3 10 4 10 5…
-
-1
votes1
answer70
viewsDuplication of PHP data
I have a very large page (Main software flow). I’m experiencing a problem that rarely happens, but sometimes the request is duplicated, as if I had sent twice the same form, only no, I just clicked…
-
-1
votes1
answer3120
viewsSQL database structure of a library
I need to write and populate a Mysql database relative to the control of a library. This involves: 3 tables: | publisher | book | author | The 'publisher' table must have: id, name, city, state,…
-
-1
votes1
answer578
viewsConnection String C# Entityframework
Would continue a project of work at home, the Connection String that works is as follows: <add name="DBModel" connectionString="data source=PD_22;initial catalog=EXERCICIO_ENTITY_JOSEEDUARDO;user…
-
-1
votes1
answer1291
viewsCompare data from a table in Postgresql
Good morning. I have two tables in the same database, with the same name, but in different schemes. I want to compare the records that are in them, to see if there are identical data. Is there any…
-
-1
votes1
answer72
viewsPHP, error making query
My problem is, I’m looking for a query, but I’m not getting all the records, and this is what I’m not getting. I’ll change SQL later, so I left it like this to test. Can someone help me?? this is…
-
-1
votes1
answer42
viewsEnter a column if it exists in ALL elements of another SQL
I have the following question : "Enter the "name3" that are in ALL "name" . And I have 4 tables that are below -- A (name,Num2, local) insert into A values ('Favela',1,'WE'); insert into A values…
-
-1
votes2
answers82
viewsTo obtain number of elements depending on the maximum number of elements per groups
I have two tables and I intend to get you the name table A depending on the Num3. For example, in the table A, we have the num2 and in the table B the values corresponding to the Num1. What I want…
-
-1
votes1
answer51
viewsSelect with most messaging users
I’m making a system and I have to know which user sent the most messages. My tables are more or less like this: User id|nome|sobrenome|email| ... Messages id|uid|nome|email|assunto|msg| ... I just…
-
-1
votes1
answer708
viewsHow to know how many sales for each month?
I need to set up a query that brings the total sales of each month from a table called sales.SalesOrderHeader, but I’m not getting it. In this table there is a field OrderDate which is the date of…
-
-1
votes2
answers3054
viewsManipulating file . sql
I have a *.sql. file How do I transfer/use to a database? Have the records in the database. (I was sent and do not know have the data inside my database, to then use with php)
sqlasked 7 years, 2 months ago MFrancisca 11 -
-1
votes1
answer102
viewsperformance in a select query
For DBMS what is faster to receive all the fields specified or use the character * which represents all fields. If there is a difference, why? Select coluna1,coluna2,coluna3, .....,colunaN from Or…
-
-1
votes1
answer57
viewsI am creating a school system, I want together a list of linked teachers and materials Database (Mysql)
I am creating a school system, I want to add a list of teachers linked to materials and virse and versa. I use the Mysql database Example: Professor 1 - Materia 1 Professor 1 - Materia 2 Professor 1…
-
-1
votes1
answer765
viewsUpdate in two MYSQL tables
How to update two tables, e.g.: first table users, would update only on senha, but on the table users_info would update cos fields, cidade, nascimento, sexo and etc. I can do it in one, but I wanted…
-
-1
votes1
answer5179
viewsDiscover user password through Select or View?
I’m running a BD which was made by a developer who created a table of operators, it turns out that he is no longer in the world of the living. How to discover a user’s password through a table or a…
-
-1
votes2
answers2808
viewsArithmetic overflow error Converting Expression to data type int in Count
I’ve seen several responses to that message Arithmetic overflow error Converting Expression to data type int. However, everything they indicated to do did not work. It only gives error when using…
-
-1
votes1
answer412
viewsJoin 2 SQL with different results
They work perfectly, but now I need to join them, but the results will be different or I can not join the result, but rather join the SQL and get the result of the two below, but I do not know how…
-
-1
votes1
answer697
viewshow to popular the object array with Sqlite data
Well come on, I’m doing an application, this will have several student names. I made a method that add each name in a table of BD. in the comic is like this(Antonio, Pedro, Caio, Felipe......). I…
-
-1
votes1
answer29
viewsScheduled Backup in Azure SQL Database
I know that the backups in SQL Azure are automatic, but how can I make a configuration in them? Schedule for a certain time?
-
-1
votes2
answers1797
viewsHow to take data from 3 tables with INNER JOIN performatively
I got three tables on the bench, Exercise and Exercise. I need to do the SELECT with the INNER JOIN and differentiate columns with the same name: SELECT t.id AS tid, et.id AS etid, e.id as eid,…
-
-1
votes1
answer353
viewsSql in Postgresql: Do Not Repeat Values from a Table field
I have a select that displays the names, date and amounts paid by customers. I must display a list without repeating the names. SELECT c.name, p.created_at, p.amount_paid FROM payments as p, clients…
-
-1
votes1
answer531
viewsAndroid Application and Mysql Database
I have an application developed on Android and need to connect to a Mysql database that is local on a Desktop. I can easily get the IP address of the machine where the bank is. How can I connect the…
-
-1
votes2
answers517
viewsSlow response (PHP MYSQL)
<?php require('DB.class.php'); //$conexao = mysql_connect('xxx.xxx.xxx.xxx','base_dados','utilizador'); //$db = mysql_select_db('base_dados',$conexao); $SQl_list =…
-
-1
votes1
answer916
viewsObject of class mysqli could not be converted to string
I’m having the following mistake: Object of class mysqli could not be converted to string. PHP code: <?php include("config.php"); $query = $_GET['query']; $min_length = 3; if(strlen($query) >=…
-
-1
votes3
answers47
viewsPHP-error but still sends what is requested
I have the following code, if I do not make a particular request it sends an error, if there is no such error send email to the user. the problem is that in addition to appearing the error and also…
-
-1
votes1
answer53
viewsError in my query ifnull. why?
Query that this marked red does not work and blue works! SELECT * FROM posts LEFT JOIN (SELECT COUNT(id_rela_post), ifnull(qt_vezes, 0), para FROM rela_post GROUP BY para) post_detalhe on…
-
-1
votes2
answers1365
views"ORA-01417: a table may be Outer joined to at Most one other table"
I’m riding a select and I came across the following mistake: ORA-01417: a table may be Outer joined to at Most one other table SELECT A.SEQPESSOA, A.NUMERONF, A.NROEMPRESA, A.SEQPRODUTO,…
-
-1
votes1
answer48
viewsUpdate by value difference per id
I am trying to perform an update through this select, where I see what are different data from the pen_registration table, but when trying to perform an update, it presents errors: [MYSQL] UPDATE:…
-
-1
votes1
answer123
viewsHow to give Count up to a limited value, "countar up to 90 on a table that has 100"
I assembled the following Query - "INFORMIX" SELECT COUNT(1) FROM (SELECT * FROM NOTA_FISCAL_NFE LIMIT 90); Which returns me the following error: An error occurred when executing the SQL command:…
-
-1
votes3
answers122
viewsGet the record name in the most repeating column
I need to display the record that repeats most in the column tipo_doenca from the column localidade, that is to exhibit the disease that is in the largest quantity in that locality. Table name:…
-
-1
votes1
answer77
viewsFetch last recorded date in sql cpf_cnpj
I have a basis that I need one of the columns to be the search for the lowest date recorded on that CPF/CNPJ in the base. In the example would create the column data_anterior: cpf_cnpj | aplicado|…
-
-1
votes2
answers1495
viewsSQL Server Function - Holidays
Good afternoon! Dear friends, I have the following function below that is the days not worked that are coming only Saturday and Sunday, however, I wanted to include in this function the holidays.…
-
-1
votes2
answers101
viewsLinq equivalent to the t-sql command
How to make the LINQ equivalent to the following SQL? Select sum(case when periodo = 1 then isnull(valor,0) else 0 end) Jan, sum(case when periodo = 2 then isnull(valor,0) else 0 end) Feb, sum(case…
-
-1
votes2
answers417
viewswhat I must do to authenticate the user correctly
I’m in need of help to authenticate users on my site but I don’t know what the sql variable that I hosted returns when you find the right user what I put in if? <?php include 'conexao.php';…
-
-1
votes1
answer2686
viewsHow to make a SE function in SQL
Good morning. How do I make a SE function in SQL server? For example, I have data in a column and when it is = '1';'masculino';'feminino'. You can help me please?
-
-1
votes1
answer1763
viewsCalculate SQL mean with time field
Good morning Everyone, I’m having trouble solving the select below. I have the select below that returns me the amount of hours of a given event and by the return visa in varchar. What I’m having…
-
-1
votes1
answer344
viewsAlternative to Phpmyadmin
Can anyone tell me a database manager where I can build more complex queries without having to enter the query? Just clicking where I want to make a SELECT for example? I need to do several queries…
-
-1
votes1
answer213
viewsComposite primary key definition syntax in the H2 Database engine
I am trying to define a primary key composed of two columns when creating a table in the H2 Database Engine (http://www.h2database.com/html/main.html), but I couldn’t find the syntax in the manual.…
-
-1
votes3
answers737
viewsMake an "Update" with sum of a number that is as character
I need to perform a update summed in a table whose column is of the type text. Example: UPDATE produto SET codigo = 'codigo'+ 1; I have the following return: UPDATE produto SET codigo = 'codigo'+ 1;…
-
-1
votes1
answer113
viewsHow to do multiple run with PDO
I have a very simple user update form, but I am not able to successfully update using PDO and mysql. Follow the excerpt of the code I’m in trouble with: if (isset($_POST['ID'])){//Se informar o ID…
-
-1
votes1
answer491
viewsMysql, PHP and HTML communication
Good evening guys, I had already talked about this, but it seems like you’re not getting what I mean, so I’m going to go ahead and explain: As far as I’m concerned, I did everything right, in my…
-
-1
votes1
answer35
viewsHow to put zeros after type checker - sql server
I need to put 9 zeros after 02: 0207200000053P 02- here comes the zeroes - 07200000053P that is coming from a variable called @vNossoNumero. How do I do that? Variable Select @vNossoNumero = case…
-
-1
votes1
answer881
viewsSet auto-increment in Dbeaver
After creating the column idpagamentoCielo as a primary key, I could not add property auto-increment to the column. How can I assign the property auto-increment to the column idpagamentoCielo? Note:…
-
-1
votes1
answer99
viewsSQL query inside java
I have the following query inside a file jsp in Java. String sql = "SELECT * FROM products WHERE productName = ? "; I would like my consultation to ignore Camel case and return all the words that…
-
-1
votes1
answer705
viewsReturn SQL array in a php variable, for later HTML assembly
I need to do a database search on a date variable and return only the Years. For this I did the following : In control: public static function getDataAnos() { $bd = new Banco(BANCO_HOST,…
-
-1
votes3
answers1256
viewsHow to do an INNER JOIN bringing everything from two tables and one more "max" in a specific field?
Good guys, to be more specific I have two tables,. table 01: ...and table 02: ...and would like to make a "select" bringing all of these two tables, but where in the field "points" (table 02) have…
-
-1
votes4
answers126
viewsCan I put a WHERE for each column?
I’m willing to put a condition for each column in my SELECT, this is possible? SELECT count(id_casa) as casaAzul, count(id_casa) as casaAmarela FROM tb_casa Where: Where column 1: Where cor_casa =…
-
-1
votes1
answer309
viewsQuery with two sorts in descending order
There is the possibility of executing a query searching by contract number, ordering by descending date and their respective service orders? If so, can you give me an example for knowledge?? Query…
-
-1
votes2
answers52
views