Most viewed "mysql" questions
Mysql is a relational database management system (RDBMS) that functions as a server, and provides access to multiple users simultaneously. Your source code is available under the GNU General Public License.
Learn more…10,264 questions
Sort by count of
-
26
votes2
answers119390
viewsHow to insert date and datetime into a table in Mysql?
The big problem is that after the insert, all values that have date, are as zeroes and in the format yyyy-dd-mm and not dd/mm/yyyy, as it was inserted initially. How can I insert these values into…
-
6
votes1
answer100270
viewsHow to resolve Call to Undefined Function mysql_connect() error
I’m doing an IT inventory for registration and I want to connect to the database, but it’s giving this error: Fatal error: Uncaught Error: Call to Undefined Function mysql_connect() in C: xampp…
-
10
votes5
answers98198
viewsHow to display the result of a query on an PHP html page?
How can I display the results of a query in a table of an html page? Below is what I was able to do. However, the code only shows the first record. include("conectar.php"); $sql =…
-
6
votes2
answers91876
viewsHow to add a Foreign key to an already created table
I’m a beginner in mysql and can’t add a fk to a table I created. I have two tables (person, object) and I want to create a 'fk_person' in object that receives the value of the 'id' attribute of…
-
33
votes5
answers74978
viewsHow to get the table name and attributes of a Mysql database?
How to get the names of all tables in the database Mysql? How to get the attributes (name, type, etc...) of a given table in the Mysql database?
-
6
votes3
answers71632
viewsHow to make a select in the bank not to bring repeated values?
For example have in the table the values: green, red, blue, blue, pink, pink, pink, yellow. I would need to return from the colors table only once the blue and the pink. Is there any way to do this?…
-
15
votes3
answers70810
viewsWhat are the appropriate data types for columns like address, email, phone and mobile phone for SQL database?
What kind of data are recommended to create the following fields: address, email, mobile number/phone?
-
29
votes7
answers68940
viewsHow to make SELECT with ORDER BY and different criteria?
People can select with 2 "ORDER BY"? Table CATEGORY: If I make a SELECT like this: select id,nome from CATEGORIA ORDER BY nome ASC Mysql returns the names in alphabetical order, but I need it to…
mysqlasked 9 years ago Hugo Borges 5,294 -
5
votes4
answers64762
viewsMysql installation socket error
I am unable to uninstall or make Mysql 5.5 work on my Ubuntu Linux 14.04.LTS, every time I try to access it, I get the following message: ERROR 2002 (HY000): Can’t connect to local Mysql server…
-
9
votes1
answer58526
viewsHow do I make a SELECT in 2 or more Tables with 2 or more conditions?
I have a problem making a select with the following conditions: I want to show the data either with condition1 or with condition2 Select * tabela inner join tabela2 WHERE campo = 0 and campo2 = ''…
-
5
votes4
answers58320
viewsError: Access denied for user 'root'@'localhost' (using password:NO) accessing Website
Good afternoon, I’ve been trying to run a website through a Raspberry to access with remote access. I installed OS Pipplware, along with Lamp and phpmyadmin. I sent through Filezilla the website…
-
11
votes6
answers57963
viewsHow to convert UTF-8 characters in PHP
In my web application, I am using a Mysql database that has the table EditableContent. This table has the field content, who’s kind text and has as input format utf8-bin. In the database the…
-
4
votes5
answers57768
viewsCount equal records with SELECT DISTINCT and COUNT
How do I count the equal results and add the amount in front? For example: Currently the records of my table are like this: Id | Nome ------------ 0 | Teste 1 | Teste 2 | Teste I want to give a…
-
117
votes3
answers57155
viewsCharset iso-8859-1 and utf-8 compatibilization problems
The 1st Image I use the charset=iso-8859-1 In this 2nd image I use utf8 I have a news system where you can paste html or text from other pages. On the page where the news are presented I use the…
-
9
votes2
answers55209
viewsSet OPTION as SELECTED based on database values
I am preparing a form where I am setting the values of the fields with the database data. I’m having trouble setting the chosen option as selected to the <select/> in the code below: PHP…
-
8
votes7
answers54187
viewsRemove letters and special characters in a select
I have in my table the field documento with the following data: How do I select only the numbers of these records by removing the letters and special characters? DOCUMENT CPF-12345698-35…
-
13
votes5
answers53548
viewsMysql decimal value
I am trying to insert decimal value in mysql database, wanted to put these values for example: 1.500,00 Thousand, hundred and ten What is the type of column I must declare?…
-
6
votes4
answers53244
viewsDifferent ways to count record numbers in Mysql
There’s a difference in performance if you do: //seleciona todos os itens da tabela $cmd = "SELECT * FROM produtos"; $produtos = mysql_query($cmd); //conta o total de itens $total =…
-
8
votes6
answers52587
viewsHow do I use a database on an HTML site?
I am interested in making a site that will use a database, many told me they use Mysql to do this, but I have no knowledge about it, installation, use etc. I have knowledge in PHP, HTML, CSS and…
-
3
votes3
answers50069
viewsHow to display all the results of a SELECT in PHP?
I’ve done all this code myself, but I’m having a hard time displaying all the results below each other. <?php include 'conexao.php'; ?> <html> <head> <title>GMB Mineração e…
-
26
votes1
answer48265
viewsWhat character encoding (Collation) should I use in Mysql?
What is the most appropriate character encoding (Collation) for a Mysql database that will store Portuguese language data?
-
9
votes3
answers46833
viewsHow to rename the column name SQL Table
I want to rename the column name via SQL. I am trying as follows: ALTER TABLE nomes_clientes RENAME COLUMN primeiro_nome TO nome, RENAME COLUMN segundo_nome TO sobrenome; But that way it’s not…
-
5
votes5
answers45344
viewsAccess website on local network through my Android phone
I made a site in PHP and Mysql responsive and would like to access it on my Android phone by localhost, I know I have to put my IP on browser but when I send access it appears the following error:…
-
16
votes3
answers44552
viewsHow to connect Python to Mysql database?
I wonder how I can make a simple connection to Mysql through a Python script. To do this I need to install some library? Or is there something that comes by default in Python (like in PHP)?…
-
45
votes5
answers41645
viewsWhat are the advantages and disadvantages between Mysql and Postgresql?
I have been with this doubt for a long time, I see some people recommending the use of Postgresql, but it is not clear the advantages and disadvantages compared to Mysql. I want to define the bank…
-
32
votes5
answers41630
viewsMysql Limit Equivalent in SQL Server
Someone knows how to relate the differences between Mysql and SQL Server, including using LIMIT n,n? Or if you have a link that lists the differences would be nice. Example SELECT * FROM tabela…
-
6
votes4
answers41617
viewsSign of different Query
I have a problem presenting the Query. I got the field alvaraValidade which only receives Data fields. When I put nothing in that field, the field date is guarded as 0000-00-00. $sql = "Select *…
-
20
votes2
answers40655
viewsDifference between datetime x timestamp?
I am building a diagram in Mysql Workbench and I came up with this question, what is the difference between the two? I will work with this base in Java, java has problem with some of them?…
mysqlasked 10 years, 4 months ago LucasMotta 1,026 -
3
votes5
answers40467
viewsHow to redirect php pages
I have a login system in a program PHP that I want it to forward users to different pages depending on their profile. There is a login table that has a field called "perfil" who is either 0 or the…
-
2
votes2
answers40109
viewsGet values from one table that are not contained in another
I would like to know how I can get values from a mysql database and the data obtained should be in one table and not in another. For example: I want all equipment (equipment table) that is not…
-
9
votes5
answers38375
viewsConvert date to dd/mm/yyyy format
I’m getting two PHP post of two dates in format dd/mm/yyyy, however to display the data need to convert dd/mm/yyyy for yyyy-mm-dd. Code: if (isset($_POST)) // Se existir o array post, pq ele não…
-
14
votes2
answers36430
viewsUpdate with Inner Join
If I make a consult like update using the clause Inner Join, the update will affect all fields that satisfy the condition imposed on Inner Join or just the first field?…
-
24
votes3
answers36150
viewsHow to use Mysql on Android
After some searches, I saw that the only database that Android can use is Sqlite, It is correct this information? Because I have an application that connects to an online database (Mysql) and would…
-
12
votes5
answers35616
viewsSELECT condition WHERE with multiple values in the same column
I have two tables in my bank and perform JOIN with them. A table is a list of people and the other characteristic list of that person. By logic there is only one person and each person can have…
-
19
votes4
answers35413
viewsHow to check events between 2 dates in Mysql?
Knowing I have a table called eventos, and this table has the columns id, titulo, inicio and fim. The columns inicio and fim are of the type timestamp, where the date and time of the start and end…
-
3
votes3
answers34761
viewsError: "You have an error in your SQL syntax"
I am getting the following error when time to perform a query to insert data into a table in the database: You have an error in your SQL syntax; check the manual that Corresponds to your Mysql…
-
2
votes3
answers33562
viewsUpdate records from one table using values from another table
I need to update a table with the value of another table and there are many records so why I’m doing it this way, but my query is not working: UPDATE produtos SET produtos.fornecedor =…
mysqlasked 11 years, 2 months ago Silvio Andorinha 8,394 -
5
votes2
answers33357
viewsHow to get the current date in Mysql?
I intend to create an event so that every hour will see if the expiration date of the announcement is higher than the current date, in this case it will have to change a theme of this announcement…
mysqlasked 10 years, 2 months ago Pedro Piloto 441 -
11
votes2
answers32556
viewsHow to remove duplicate lines efficiently?
I’m normalizing a table here and found that there are duplicate lines. The way I chose to clear these lines is through the: CREATE TABLE tabela_nova AS ( SELECT DISTINCT * FROM tabela_antiga ); The…
-
19
votes3
answers32219
viewsFetch last 7 days data from current date
I’m making a BD query, and I want to receive results from the last 7 days from the current date. For that, I have a field data of type DATA (yyyy-mm-dd) in table. I am doing the query in php, in…
-
9
votes7
answers31206
viewsHow to insert data into DB with jQuery/Javascript without using PHP?
I am learning Javascript and jQuery and I am wanting to make a small site to test the insertion of data in a database. I have no knowledge in PHP, I wonder if it is possible to insert data in a…
-
1
votes3
answers30995
viewsInsert date in Mysql via PHP
I want to insert an HTML FORM that I made the field DATE, however it is in format dd/mm/yyyy and mysql only accepts yyyy-mm-dd. How do I convert the date to insert correctly into the Mysql database…
-
4
votes3
answers30960
viewsHow to query in Mysql with two different conditions in WHERE
I have two queries that work perfectly separately, but I needed all their records together. Would be these: SELECT b.idBanca AS idB, b.DataHora AS dataHora, b.Sala AS sala, t.idTrabalho AS idT,…
-
6
votes4
answers30736
viewsPermission error when trying to access database
I took a little project already ready to study, only that is giving this error, recently migrated to the Ubuntu and I do not know what to do. Error: SQLSTATE[28000] [1045] Access denied for user…
-
9
votes7
answers30383
viewsHow to dump a Mysql database with PHP?
Currently, to export only the structure of a given database, I use the following: mysqldump -h host -u usuario --no-data --database banco > dump.sql -psenha This generates an SQL file, all…
-
5
votes2
answers30209
viewsMysql, types of comments
I had already realized that mysql, maybe not even the only case, but I would like an explanation on top of this to be more objective. I have several types of comments that are accepted: 1) -- ESTA…
-
20
votes2
answers29759
viewsChange the "collation" and "Character set" of the database, tables and corresponding columns
Some older projects were designed for their immediate purpose and based on this, the databases, tables and columns were prepared in a way limited to the intended scenario. In order to update and…
-
6
votes5
answers29249
viewsHow to calculate age based on DATE of birth in Mysql based on month and day?
I have the appointment below, but she ignores the month and day of birth SELECT FLOOR(DATEDIFF(NOW(), c.nascimento) / 365) AS idade FROM clientes c In the result, most come right, but sometimes have…
-
4
votes1
answer29006
viewsvariables in mysql: declare, set, how to pick an element from a table
Speaking of variables that can be declared within the begin, I saw that you have Declare e set only that I don’t know when to use them. I saw that you have set @x, set x, set x = x+1, set x := x+1;…
-
3
votes2
answers28630
viewsConvert Mysql data dd/mm/yyyy to yyyy-mm-dd
I have a database where I entered the dates in the format dd/mm/yyyy (example: 05/11/1987), but now I’m organizing some reports and need to update all dates in the database to the format yyyy-mm-dd…