字幕列表 影片播放 列印英文字幕 hi guys welcome to this tutorial and in this tutorial we will focus on how to insert data into the table we created last time so I have already browsed through to the folder where my MySQL application is present so now i have to connect to my MySQL server so I will do mysql -u username (i.e. root) -p password (i.e. no password) -h hostname (i.e. 127.0.0.1 or localhost) I don't have a password so I will just press Enter It says you are connected to MySQL if in your case it is showing that some error has occured then just go ahead and open up u'r XAMPP control panel and check here if the MySQL server is running. If it's not running then click on start. So, in the last tutorial we created a database named userlogin. Inside that databse we created a table called user and inside that table we inserted some parameters 4 parameters actually id, username, password and email. So, in this tutorial we will just insert data into that table So, first of all I will do a show databases. show databases; There it is userlogin Now again I will write use userlogin; and then show tables; So, there is just one table. Now describe user; So, here it is. 4 parameters are present id, username, password and email. and these are the characteristics of those parameters. And in this tutorial we will just insert data into those fields. So lets start by writing Insert into our table name is user and I will start the paranthesis here We don't have to insert the value of ID because, it is set to auto-increment. So it will automatically increase. We will just have to insert the value of username password and email just press Enter here and here I will write my values. So, our username is a Varchar of 25 chars. So for varchar you have to use single quotes Remember that you have to use only single quotes because double quotes won't work for MySQL. Suppose my username is 'primetuber' Comma my password will be 12345 and suppose my email-ID is abc123@hotmail.com Now I will close my paranthesis here end those statements and press enter. it says query Ok and 1 rows affected.Now we have inserted values into our table and we can see those values by typing in SELECT * FROM user; So, here it is ID = 1, username = primetuber, password =12345 and email = abc123@hotmail.com. Now I will another set of data into this table. So I will write INSERT INTO our table name is user and id, I don't have to enter So, username then password and email i don't have to press Enter. I can just write values and I will start with username suppose username is java password is javanet and email-ID is javac@gmail.com we will end the paranthesis add semicolon and press Enter It says query OK. 1 row affected. Now to see all the data present in the table I will write SELECT * FROM user and add semicolon and press Enter. so here it is. When ID is 1 username is primetuber password is 12345 and email is this When ID is 2 username is java password is javanet and email is this So, this is for this tutorial and in the next tutorial We will talk about more about updating a database and Selecting from databases. so thank you for my video and if u like the video don't forget to subscribe
B1 中級 MySQL初學者教程 - 2 - 向數據庫中的表添加數據。 (MySQL Tutorial for Beginners - 2 - Adding Data to Tables in a Database) 83 2 陳柏霖 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字