B1 中級 其他腔 1087 分類 收藏
開始影片後,點擊或框選字幕可以立即查詢單字
字庫載入中…
回報字幕錯誤
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
提示:點選文章或是影片下面的字幕單字,可以直接快速翻譯喔!

載入中…

MySQL初學者培訓課程 - 2 - 新增資料到資料庫中的資料表 (MySQL Tutorial for Beginners - 2 - Adding Data to Tables in a Database)

1087 分類 收藏
陳柏霖 發佈於 2015 年 2 月 13 日
看更多推薦影片
  1. 1. 單字查詢

    在字幕上選取單字即可即時查詢單字喔!

  2. 2. 單句重複播放

    可重複聽取一句單句,加強聽力!

  3. 3. 使用快速鍵

    使用影片快速鍵,讓學習更有效率!

  4. 4. 關閉語言字幕

    進階版練習可關閉字幕純聽英文哦!

  5. 5. 內嵌播放器

    可以將英文字幕學習播放器內嵌到部落格等地方喔

  6. 6. 展開播放器

    可隱藏右方全文及字典欄位,觀看影片更舒適!

  1. 英文聽力測驗

    挑戰字幕英文聽力測驗!

  1. 點擊展開筆記本讓你看的更舒服

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔