本文主要給大家簡單講講如何通過MySQ3.3參考手冊(cè)創(chuàng)建并使用數(shù)據(jù)庫,相關(guān)專業(yè)術(shù)語大家可以上網(wǎng)查查或者找一些相關(guān)書籍補(bǔ)充一下,這里就不涉獵了,我們就直奔主題吧,希望如何通過MySQ3.3參考手冊(cè)創(chuàng)建并使用數(shù)據(jù)庫這篇文章可以給大家?guī)硪恍?shí)際幫助。
創(chuàng)新互聯(lián)公司是專業(yè)的南木林網(wǎng)站建設(shè)公司,南木林接單;提供成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行南木林網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!3.3.1 Creating and Selecting a Database
3.3.2 Creating a Table
3.3.3 Loading Data into a Table
3.3.4 Retrieving Information from a Table
3.3.1 創(chuàng)建和查看數(shù)據(jù)庫
3.3.2 創(chuàng)建表
3.3.3 將數(shù)據(jù)加載到表
3.3.4 檢索表中的信息
Once you know how to enter SQL statements, you are ready to access a database.
上一節(jié)你知道了怎么輸入SQL 語句。你已經(jīng)準(zhǔn)備好訪問數(shù)據(jù)庫了。
Suppose that you have several pets in your home (your menagerie) and you would like to keep track of various types of information about them. You can do so by creating tables to hold your data and loading them with the desired information. Then you can answer different sorts of questions about your animals by retrieving data from the tables. This section shows you how to perform the following operations:
假設(shè)你家有幾只寵物,你想追蹤他們的一些信息,你可以通過創(chuàng)建表來保存數(shù)據(jù),按照所需加載數(shù)據(jù)。你就可以從表中檢索數(shù)據(jù)來回答關(guān)于動(dòng)物的不同問題。這一節(jié) 向你展示了 如何進(jìn)行以下操作。
Create a database
Create a table
Load data into the table
Retrieve data from the table in various ways
Use multiple tables
創(chuàng)建一個(gè)數(shù)據(jù)庫
創(chuàng)建一個(gè)數(shù)據(jù)庫
向表中加載數(shù)據(jù)
用不同的方式在表中檢索數(shù)據(jù)
使用多個(gè)表
The menagerie database is simple (deliberately), but it is not difficult to think of real-world situations in which a similar type of database might be used. For example, a database like this could be used by a farmer to keep track of livestock, or by a veterinarian to keep track of patient records. A menagerie distribution containing some of the queries and sample data used in the following sections can be obtained from the MySQL Web site. It is available in both compressed tar file and Zip formats at http://dev.mysql.com/doc/.
menagerie 數(shù)據(jù)庫是簡單的(故意的),但是不難想象真實(shí)情況下相似情況的數(shù)據(jù)庫。例如一個(gè)類似的數(shù)據(jù)庫可以被農(nóng)民用來記錄用來跟蹤牲畜,或由獸醫(yī)追蹤病寵的記錄。你可以從MySQL網(wǎng)站獲取menagerie數(shù)據(jù)庫,它包含一些語句和簡單的數(shù)據(jù)。在http://dev.mysql.com/doc/網(wǎng)站上提供 tar(linux) 和 Zip(windows)兩種打包的版本。
Use the SHOW statement to find out what databases currently exist on the server:
使用SHOW語句來查×××器上當(dāng)前存在的數(shù)據(jù)庫:
mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | | tmp | +----------+
The mysql database describes user access privileges. The test database often is available as a workspace for users to try things out.
mysql 數(shù)據(jù)庫 描述了用戶的訪問權(quán)限。test 數(shù)據(jù)庫 通常是給用戶提供測(cè)試空間。
The list of databases displayed by the statement may be different on your machine; SHOW DATABASES does not show databases that you have no privileges for if you do not have the SHOW DATABASES privilege. See Section 13.7.5.15, “SHOW DATABASES Syntax”.
語句顯示的數(shù)據(jù)庫列表可能在您的機(jī)器上不同; SHOW DATABASES不顯示那些 你沒有SHOW DATABASES 權(quán)限的數(shù)據(jù)庫。請(qǐng)參見第13.7.5.15節(jié)“SHOW DATABASES語法”。
If the test database exists, try to access it:
如果test數(shù)據(jù)庫存在,請(qǐng)嘗試訪問它:
mysql> USE test Database changed
USE, like QUIT, does not require a semicolon. (You can terminate such statements with a semicolon if you like; it does no harm.) The USE statement is special in another way, too: it must be given on a single line.
USE, 類似 QUIT,不需要分好(如果你喜歡,你可以使用分號(hào)終止這樣的語句;這樣做是OK的)另一方面 USE 是特殊的:use語句只能寫在一行之中。
You can use the test database (if you have access to it) for the examples that follow, but anything you create in that database can be removed by anyone else with access to it. For this reason, you should probably ask your MySQL administrator for permission to use a database of your own. Suppose that you want to call yours menagerie. The administrator needs to execute a statement like this:
您可以使用test數(shù)據(jù)庫(如果您有權(quán)訪問該數(shù)據(jù)庫)以獲得以下示例,但是任何可以訪問該數(shù)據(jù)庫的人都可以刪除該數(shù)據(jù)庫中創(chuàng)建的任何內(nèi)容。因此,您可以要求您的MySQL管理員僅僅允許你訪問該數(shù)據(jù)庫。假設(shè)你想訪問你的 menagerie數(shù)據(jù)庫。管理員需要執(zhí)行如下語句:
mysql> GRANT ALL ON menagerie.* TO 'your_mysql_name'@'your_client_host';
where your_mysql_name is the MySQL user name assigned to you and your_client_host is the host from which you connect to the server.
your_mysql_name 是分配給您的MySQL用戶名,your_client_host是你的主機(jī)。
如何通過MySQ3.3參考手冊(cè)創(chuàng)建并使用數(shù)據(jù)庫就先給大家講到這里,對(duì)于其它相關(guān)問題大家想要了解的可以持續(xù)關(guān)注我們的行業(yè)資訊。我們的板塊內(nèi)容每天都會(huì)捕捉一些行業(yè)新聞及專業(yè)知識(shí)分享給大家的。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。