{"id":215,"date":"2018-07-13T04:52:38","date_gmt":"2018-07-13T04:52:38","guid":{"rendered":"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=215"},"modified":"2018-08-10T09:58:25","modified_gmt":"2018-08-10T09:58:25","slug":"mysql","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/chapter\/mysql\/","title":{"rendered":"MySQL"},"content":{"raw":"<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">MySQL is an open source relational database management system (RDBMS). As like other RDBMS, MySQL support to store and retrieve data. MySQL allows working multiple users simultaneously. It supports that only authorized users can access the data. MySQL uses the standard query language SQL (Structured Query Language). MySQL is considered as the world\u2019s most popular open source database.<\/p>\r\n&nbsp;\r\n\r\nMySQL available under two license schemes.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">1. It can be available as open source license (GPL \u2013 General Public License)<\/p>\r\n2. It can be purchased as commercial license.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Generally, PHP and MySQL are used to develop dynamic websites as both the soft wares are open source. Both these software work on majority of Operating Systems.<\/p>\r\n&nbsp;\r\n\r\n<strong>MySQL strengths<\/strong>\r\n\r\n&nbsp;\r\n\r\nMySQL has many strengths like\r\n<ul>\r\n \t<li>Performance<\/li>\r\n \t<li>Portability<\/li>\r\n \t<li>Easy to learn<\/li>\r\n \t<li>Support for MySQL is available<\/li>\r\n \t<li>Low cost<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>Work with MySQL<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">MySQL allows to work with GUI (Graphical User Interface) or command-line interface. To work with MySQL command line, there is option named MySQL console. MySQL console is available in MySQL menu of WAMP server from status bar.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">As you click on MySQL, the server asks password. By Default, there is no password, so you need to just press the enter key.<\/p>\r\n&nbsp;\r\n\r\nTo login from another machine to MySQL type,\r\n\r\n&nbsp;\r\n\r\nMysql \u2013h &lt;hostname&gt; -u &lt;username&gt;\u00a0 -p\r\n\r\n&nbsp;\r\n\r\nWhere \u2013p means password.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To use MySQL in GUI, click phpMyAdmin menu of WAMP server from status bar. PhpMyAdmin is a web-based client of MySQL.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To work with MySQL, you should have access to MySQL. To access MySQL, the privilege should be assign to user. The user can access the MySQL by using username and password.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let us create a database named Account in MySQL. The database name is Account which having following tables.<\/p>\r\n&nbsp;\r\n\r\n<span style=\"color: #3366ff\">Vendor (vid, vname, vaddress, vcity,vmobile)<\/span>\r\n\r\n<\/div>\r\n<span style=\"color: #3366ff;text-align: initial;font-size: 1em\">\u00a0 \u00a0Invoice (iid,vid,inumber,idate,itotal,ptotal,ctotal,pdate)<\/span>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To create a database, create database statement is used. Following command create a database named account.<\/p>\r\n&nbsp;\r\n\r\nCreate database account\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To create a database only if it does not exist, if not exists clause is used with create database statement.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Create database if not exists account<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To select a database, use statement is used. For instance, to select account database you can write.<\/p>\r\n&nbsp;\r\n\r\nuse account\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To drop a database, drop database statement is used. For instance, to drop the database account<\/p>\r\n&nbsp;\r\n\r\nDrop database account\r\n\r\n&nbsp;\r\n\r\nYou can also check before drop database that the database exists.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Drop database if exists account<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Before drop database consult the database administration. In most case, though you will not have the privilege to do that.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">We are using web-based client as it is easy to use. Of course, the user can use command-line interface in case he wants.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let us create a database using MySQL.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Start WAMP server. Then click on phpMyAdmin. Click on New button at the left side in the database tab. Then it will ask user to enter database name. Enter database name, optionally you can select collation and press the create button.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now on words for simplicity, I am using GUI to use MySQL. You can see the code that can be used with MySQL monitor (CUI \u2013 Character User Interface) in GUI.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Run phpMyAdmin from statusbar. Click on database tab. Enter the name of the database and click create button. You can choose any collation from the collation.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">A collation is used to compare and sort character strings. It is a set of rules. Each collation is belonged to a single character set in MySQL. Every character set is belonged to minimum one collation. The Character set can be belonged two or more collations.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"alignnone size-full wp-image-218 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107.png\" alt=\"\" width=\"630\" height=\"305\" \/>\r\n\r\n&nbsp;\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To create tables, in the database account, click on account and it will open options for creating tables in the database account. Enter table name and number of fields required in the table. To create vendor table enter vendor as table name and 5 in number of columns.click go button will open screen to create various filed of table account with its name, data type etc. Enter and select appropriate value for each column.<\/p>\r\n&nbsp;\r\n\r\n<strong>MySQL datatypes<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">MySQL has nine most common data types. These data types divided into 3 groups : numeric, string and date\/time.<\/p>\r\n&nbsp;\r\n\r\nThe most common numeric data types are : INT, TINYINT and DECIMAL\r\n\r\n&nbsp;\r\n<table class=\"aligncenter\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 128.063px\"><strong>Data Type<\/strong><\/td>\r\n<td style=\"width: 515.063px\"><strong>Description<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 128.063px\" rowspan=\"3\">INT [(size)]\r\n\r\n&nbsp;\r\n\r\n&nbsp;<\/td>\r\n<td style=\"width: 515.063px\" rowspan=\"3\">INT (read as Integer) data type stores an integer number whose value\r\n\r\nbetween the -2147483648 and 2147483647. Size is the maximum display\r\n\r\nsize. By default the size is 11.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 128.063px\" rowspan=\"2\">TINYINT [(size)]\r\n\r\n&nbsp;<\/td>\r\n<td style=\"width: 515.063px\" rowspan=\"2\">TINYINT data type stores an integer number whose value between -127 and\r\n\r\n128. Size is the maximum display size. By default size for TINYINT is 4.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 128.063px\" rowspan=\"3\">DECIMAL [(p [, s] )]\r\n\r\n&nbsp;\r\n\r\n&nbsp;<\/td>\r\n<td style=\"width: 515.063px\" rowspan=\"3\">Decimal data type stores decimal number with fixed precision and scale.\r\n\r\nBoth precision and scale are optional. By default precision is 10 and scale is\r\n\r\n0.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nThe most common string data types are: VARCHAR, CHAR and TEXT\r\n<ul>\r\n \t<li>By default, MySQL use Latin-1 character set.<\/li>\r\n \t<li>The Latin-1 character set provides 256 characters. Each character occupies 1 byte for storage.<\/li>\r\n \t<li style=\"text-align: justify\">The Unicode character set provides 65000+ characters. Each character generally use 2 bytes for storage.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n<table class=\"aligncenter\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td><strong>Data Type<\/strong><\/td>\r\n<td><strong>Description<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td rowspan=\"3\">VARCHAR (size)\r\n\r\n&nbsp;\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"3\">Variable length characters. The size parameter represents maximum number\r\n\r\nof characters. The maximum number of characters stored by Varchar data\r\n\r\ntype is 65535.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td rowspan=\"2\">CHAR [(size)]\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"2\">Fixed length characters. The size parameter represents maximum number of\r\n\r\nPage 3 of 12<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n&nbsp;\r\n<div>\r\n<table class=\"aligncenter\" style=\"width: 80%\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td rowspan=\"2\">&nbsp;\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"2\">characters. The maximum number of characters stored by char data type is\r\n\r\n255. By Default size is 1.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Text<\/td>\r\n<td>Variable length characters. The maximum size is 65535 bytes.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p style=\"text-align: center\">The most common date and time data types are: DATE, TIME and DATETIME<\/p>\r\n&nbsp;\r\n\r\n<img class=\"alignnone size-full wp-image-219 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108.png\" alt=\"\" width=\"633\" height=\"531\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">You can create vendor table by writing SQL statement in case you are not prefer to use GUI. The syntax for create table is<\/p>\r\n&nbsp;\r\n\r\ncreate table\r\n\r\n( Columnname1 datatype [columnAttributes] ,\r\n\r\nColumnname2 datatype [columnAttributes] ,\r\n\r\nColumnname3 datatype [ColumnAttributes],\r\n\r\n)\r\n\r\n&nbsp;\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">To create vendor table you can code.<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0 create table vendor\r\n\r\n&nbsp;\r\n\r\n(vid int primary key auto_increment,\r\n\r\n&nbsp;\r\n\r\nvname varchar(50) unique,\r\n\r\n&nbsp;\r\n\r\nvaddress varchar(100),\r\n\r\n&nbsp;\r\n\r\nvcity varchar(50),\r\n\r\n&nbsp;\r\n\r\nvmobile varchar(11));\r\n\r\n&nbsp;\r\n\r\nSQL statement is terminated with semi-colon.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Attributes are like Primary Key, Foreign Key, Unique , Not Null, default and auto_increment. The 4 attributes - Primary Key, Foreign Key, Unique , Not Null - also known as constraint. Unique constraint ensures that the value for vname column contains unique value only. Null is a special value in SQL. Null is used when the value of a column is not known. Null is neither zero nor empty string. If you define column is not null then the column will not accept null value.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In a column more than one attribute can be added separated by space. In the previous example, vid is primary key and it has auto-increment attribute as well. Auto-increment adds value incremented by one as a new record inserted in the database.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">MySQL provides many type of storage engine like MyISAM, CSV, Memory, InnodB etc for table. The only InnoDB engine support referential integrity. So in a database, it is required to use foreign key, there must be InnoDB storage engine.<\/p>\r\n&nbsp;\r\n\r\nSQL has mainly use for 4 types of languages:\r\n\r\n&nbsp;\r\n\r\n1. Data Definition Language (DDL)\r\n\r\n2. Data Manipulation Language (DML)\r\n\r\n3. Data Control Language (DCL)\r\n\r\n4.Data Transaction Language (DTL)\r\n\r\n&nbsp;\r\n\r\n<strong>Data Definition:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">SQL lets a user define the structure and organization of the stored data and relationships among the stored data.<\/p>\r\n&nbsp;\r\n\r\n<strong>Data Manipulation:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">SQL allows a user or an application program to retrieve stored data from the database and use it. It also allows a user or an application program to add new data in the database, updating the previously stored data and removing stored data from the database.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">It is actually a CRUD operation as SQL allows user to Create(Add new data by using Insert command), Read (Retrieve data by using Select Command), Update (Update data by using update command) and Delete (Delete data by using delete command).<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Data Control:<\/strong>\r\n\r\n&nbsp;\r\n\r\nSQL can be used to provide access right and take it from user.\r\n\r\n&nbsp;\r\n\r\n<strong>Data Transaction:<\/strong>\r\n\r\n&nbsp;\r\n\r\nSQL can be used to prevent certain kinds of database errors.\r\n\r\n&nbsp;\r\n\r\n<strong>DDL Commands:<\/strong>\r\n\r\n&nbsp;\r\n\r\nCreate\r\n\r\nAlter\r\n\r\nTruncate\r\n\r\nDrop\r\n\r\n&nbsp;\r\n\r\n<strong>DML Commands:<\/strong>\r\n\r\n&nbsp;\r\n\r\nSelect\r\n\r\nInsert\r\n\r\nUpdate\r\n\r\nDelete\r\n\r\n&nbsp;\r\n\r\n<strong>DCL Commands:<\/strong>\r\n\r\n&nbsp;\r\n\r\nGrant\r\n\r\nRevoke\r\n\r\n&nbsp;\r\n\r\n<strong>DTL\u00a0 Commands:<\/strong>\r\n\r\n&nbsp;\r\n\r\nCommit\r\n\r\nRollback\r\n\r\nSave Point\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">You should select the database , so the top-row of your phpMyAdmin will show server name and database name. For example,<\/p>\r\n&nbsp;\r\n\r\n<a href=\"http:\/\/localhost\/phpmyadmin\/index.php?token=c7840aa371e1726866a24b285c000b8c\">Server: mysql wampserver <\/a>\u00bb<a href=\"http:\/\/localhost\/phpmyadmin\/db_structure.php?db=account&amp;token=c7840aa371e1726866a24b285c000b8c\">Database: account.<\/a>\r\n\r\n&nbsp;\r\n\r\nTo use the database in MySQL console mode, you should use\r\n\r\n&nbsp;\r\n\r\nUse\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;databaseName&gt;\r\n\r\n&nbsp;\r\n\r\nstatement.\r\n\r\n&nbsp;\r\n\r\ni.e. use account\r\n\r\n&nbsp;\r\n\r\nTo view the list of tables of a database, you should code in MySQL console mode. Show tables;\r\n\r\n&nbsp;\r\n\r\nTo view the structure of atbale, you should code\r\n\r\n&nbsp;\r\n\r\nDescribe &lt;tablename&gt;;\r\n\r\n&nbsp;\r\n\r\nIf you type, desc vendor;\u00a0 shows the schema\/structure of vendor table.\r\n\r\n&nbsp;\r\n\r\n<\/div>\r\n<div>\r\n<p style=\"text-align: justify\">\u00a0 \u00a0 In phpMyAdmin you can also code by click on SQL tab and type the code. For example, in SQL tab you can type<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">desc vendor and click on the Go Button. Following figure shows it.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-220 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109.png\" alt=\"\" width=\"622\" height=\"240\" \/>\r\n\r\n&nbsp;\r\n\r\nAlter table statement is used to\r\n<ul>\r\n \t<li style=\"text-align: justify\">Add a new column at the end of the table or after a specified column<\/li>\r\n \t<li>Drop a column<\/li>\r\n \t<li>Rename a column<\/li>\r\n \t<li>modify the column of existing table<\/li>\r\n<\/ul>\r\n&nbsp;\r\n<p style=\"text-align: justify\">For example, to add the column vemail after vmobile column you can code<\/p>\r\n&nbsp;\r\n\r\nalter table vendor\r\n\r\n&nbsp;\r\n\r\nadd email varchar(50);\r\n\r\n&nbsp;\r\n\r\nTo drop the column email, you can code\r\n\r\n&nbsp;\r\n\r\nalter table vendor\r\n\r\n&nbsp;\r\n\r\ndrop column email;\r\n<ul>\r\n \t<li style=\"text-align: justify\">Drop statement is used to drop the table or database also. To drop database , you can code Drop database account;<\/li>\r\n \t<li style=\"text-align: justify\">You should never drop the table or database without first consulting with database administrator.<\/li>\r\n \t<li style=\"text-align: justify\">Drop table statement deletes the definition and data of the table. Before drop the table, MySQL will check referential integrity. For example, you cannot delete vendor table if a foreign key in invoice table refers to the vendor table. In that case, you must first drop the invoice table before drop vendor able.<\/li>\r\n \t<li style=\"text-align: justify\">If the table does not exists, and you code drop table statement, then drop table statement generate an error. To prevent this error, you should code<\/li>\r\n \t<li style=\"text-align: justify\">Drop table if exists\u00a0 &lt;tablename&gt;<\/li>\r\n<\/ul>\r\n<\/div>\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial;font-size: 1em\">Indexes<\/strong>\r\n<div>\r\n<ul>\r\n \t<li style=\"text-align: justify\">An index facilitate RDBMS to go directly to a row rather than search through all the rows until found the specified searched one. Thus index speeds search.<\/li>\r\n \t<li style=\"text-align: justify\">By Default MySQL create index for primary key and unique constraint.<\/li>\r\n \t<li style=\"text-align: justify\">In RDBMS, it is required to create indexes for foreign key(s) and other column(s) which are used frequently in search condition or join tables. Index can be created for other columns. It is advisable to avoid to create index for columns which are updated frequently because it slows the insert, update and delete operation.<\/li>\r\n \t<li style=\"text-align: justify\">To create index, create index statement is used. The general syntax to create index is:<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ncreate [unique] index\u00a0 &lt;indexName&gt;\r\n\r\non &lt;tableName&gt;\u00a0 (columnName1 [asc|desc] [,columnName2 [asc|desc])\r\n<ul>\r\n \t<li>Unique keyword is used to specify that index contains only unique values.<\/li>\r\n \t<li>Asc or desc is used to specify that the index stored in ascending or descending sequence.<\/li>\r\n \t<li>An index can be created on one or more columns.<\/li>\r\n \t<li style=\"text-align: justify\">Index can be created when create table statement is used. In create table code index &lt;indexname&gt; (columnName&gt; after defining all the columns.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\nFor example, to create index on vcity column, code\r\n\r\ncreate index idxvcity\r\n\r\non vendor (vcity)\r\n<ul>\r\n \t<li>To drop an index drop index statement is used.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>Users and Privileges<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\">The root user is automatically created when MySQL is installed. Root user is an administrative user who has all the privileges to perform any operation on any database on the server. So, root user can drop any table or database.<\/li>\r\n \t<li style=\"text-align: justify\">To prevent other users from either accidently or intentionally drop entire database or drop tables, other users created with fewer privileges than root user.<\/li>\r\n \t<li>The following four privileges allows the user to work with data which is stored in the table of database.<\/li>\r\n \t<li>Select<\/li>\r\n \t<li>Insert<\/li>\r\n \t<li>Update and<\/li>\r\n \t<li>Delete<\/li>\r\n \t<li>The following four privileges allows the user to modify the structure of the database\/table<\/li>\r\n \t<li>Create<\/li>\r\n \t<li>Alter<\/li>\r\n \t<li>drop and<\/li>\r\n \t<li>Index.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\nFollowing table shows other privileges\r\n\r\n<\/div>\r\n<div>\r\n<table class=\"aligncenter\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td><strong>Privileges<\/strong><\/td>\r\n<td><strong>Description<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td rowspan=\"2\">All\u00a0 [privileges]\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"2\">All privileges available at the current level. It does\r\n\r\nnot include Grant Option privilege.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td rowspan=\"2\">Grant\u00a0 Option\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"2\">Allows a user to grant privilege available to his\/her\r\n\r\nto other users.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td rowspan=\"2\">Usage\r\n\r\n&nbsp;<\/td>\r\n<td rowspan=\"2\">No privileges. It is used to modify existing accounts\r\n\r\nwithout changing privileges for that account.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<ul>\r\n \t<li style=\"text-align: justify\">MySQL assign privileges at four different levels. These four levels are:Global, Database, Table and column. The asterisk (*) is used as wild card character to indicate all.<\/li>\r\n<\/ul>\r\n<table class=\"aligncenter\" style=\"height: 196px\" border=\"1\">\r\n<tbody>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 62.0625px\"><strong>Level<\/strong><\/td>\r\n<td style=\"height: 28px;width: 160.063px\"><strong>Example<\/strong><\/td>\r\n<td style=\"height: 28px;width: 212.063px\"><strong>Description<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 62.0625px\">Global<\/td>\r\n<td style=\"height: 28px;width: 160.063px\">*.*<\/td>\r\n<td style=\"height: 28px;width: 212.063px\">All databases and all table<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 62.0625px\" rowspan=\"2\">Database\r\n\r\n&nbsp;<\/td>\r\n<td style=\"height: 28px;width: 160.063px\" rowspan=\"2\">account.*\r\n\r\n&nbsp;<\/td>\r\n<td style=\"height: 28px;width: 212.063px\" rowspan=\"2\">All tables of the account\r\n\r\n(specified) database.<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 62.0625px\">Table<\/td>\r\n<td style=\"height: 28px;width: 160.063px\">account.vendor<\/td>\r\n<td style=\"height: 28px;width: 212.063px\">All columns of the vendor table.<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 62.0625px\" rowspan=\"2\">Column\r\n\r\n&nbsp;<\/td>\r\n<td style=\"height: 28px;width: 160.063px\" rowspan=\"2\">(vname) account.vendor\r\n\r\n&nbsp;<\/td>\r\n<td style=\"height: 28px;width: 212.063px\" rowspan=\"2\">Only vname (specified)\r\n\r\ncolumn(s)<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<ul>\r\n \t<li style=\"text-align: justify\">MySQL has many privileges. For complete list of privileges, you can refer MySQL reference manual. MySQL reference manual is available online. You can search privileges at MySQL manual by typing \u201cprivileges provided\u201d.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>Create , rename and drop user<\/strong>\r\n<ul>\r\n \t<li>create user statement is used to create a new user.<\/li>\r\n \t<li>The general syntax to create user is:<\/li>\r\n \t<li>create user &lt;username&gt;\u00a0 [@hostname]<\/li>\r\n \t<li>identified by\u00a0 \u2018&lt;password&gt; \u2018<\/li>\r\n \t<li>For example,<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ncreate user hiren@localhost\r\n\r\nidentified by 'hiren';\r\n<ul>\r\n \t<li style=\"text-align: justify\">If the hostname is not specified, MySQL uses % as a wild card character to indicate that the user can be from any host.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ncreate user hiren\r\n\r\nidentified by 'hiren';\r\n<ul>\r\n \t<li style=\"text-align: justify\">It is recommended that you should specify host when create a user.<\/li>\r\n \t<li style=\"text-align: justify\">Username must be unique for the host. For instance, I cannot create user hiren@localhost as the user hiren exists at localhost.<\/li>\r\n \t<li style=\"text-align: justify\">Rename user statement is used to change the name of user. If the original user has privileges, these privileges are transferred to the new name.<\/li>\r\n<\/ul>\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0rename user hiren to hdj@localhost;\r\n<ul>\r\n \t<li style=\"text-align: justify\">To change, password of a user, grant usage statement is used. o\u00a0 For example, to change password for hdj@localhost<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ngrant usage on *.*\r\n\r\nto hdj@localhost\r\n\r\nidentified by 'hdj@localhost';\r\n<ul>\r\n \t<li style=\"text-align: justify\">To drop user, drop user statement is used. o F<\/li>\r\n \t<li style=\"text-align: justify\">.or example, to drop hdj@localhost<\/li>\r\n<\/ul>\r\ndrop user hdj@localhost;\r\n\r\n&nbsp;\r\n\r\n<strong>Grant Privileges<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\">Before you grant privileges, you must connect as an appropriate user.<\/li>\r\n \t<li style=\"text-align: justify\">Root user has all the necessary privileges to grant privileges to another user.<\/li>\r\n \t<li>The general syntax for grant privilege is:<\/li>\r\n<\/ul>\r\nGrant\u00a0 &lt;privilege(s)&gt;\r\n\r\nOn [dbname].table\r\n\r\nTo username1 [identified by \u2018password1\u2019] [,\r\n\r\nusername2 [identified by \u2018password2\u2019]\u2026]\r\n\r\n[with grant option]\r\n<ul>\r\n \t<li style=\"text-align: justify\">In case dbname (databasename) is not specified, MySQL uses the current database.<\/li>\r\n \t<li style=\"text-align: justify\">With grant option allows the user to grant the privileges for that user to other users.<\/li>\r\n \t<li style=\"text-align: justify\">To grant select privilege to hiren@localhost for the account database<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify\"><\/p>\r\ngrant select\r\n\r\non account.*\r\n\r\nto hiren@localhost;\r\n<ul>\r\n \t<li style=\"text-align: justify\">To grant insert, update and delete privileges to hiren@localhost for the account database<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ngrant insert, update , delete\r\n\r\non account.*\r\n\r\nto hiren@localhost;\r\n<ul>\r\n \t<li style=\"text-align: justify\">Generally, create user statement is used to create user and grant statement is used to assign grant to the user. MySQL allows using grant statement to create users and grant privileges in a single statement. For example<\/li>\r\n<\/ul>\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Following grant statement create two users hj@localhost and hirenj@localhost and grants select, insert, update and delete on account database.<\/p>\r\n&nbsp;\r\n\r\ngrant select,insert, update, delete\r\n\r\non account.*\r\n\r\nto hj@localhost identified by 'hj@localhost',\r\n\r\nhirenj@localhost identified by 'hirenj@localhost';\r\n<ul>\r\n \t<li style=\"text-align: justify\">The following example shows how to grant privileges for specific columns. The below code allows select privileges for two columns vid and vname and allows update privilege for vaddress column.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ngrant select(vid, vname), update (vaddress)\r\n\r\non account.vendor\r\n\r\nto hj@localhost\r\n<ul>\r\n \t<li>To assign all the privileges, all keyword is used.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\ngrant all\r\n\r\non *.*\r\n\r\nto dba\r\n\r\nwith grant option\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>View privileges<\/strong>\r\n<ul>\r\n \t<li>To list all the users of current server, you can use select statement as shown below.<\/li>\r\n<\/ul>\r\nselect user, host\r\n\r\nfrom mysql.user\r\n<ul>\r\n \t<li style=\"text-align: justify\">MySQL uses an internal database mysql. This database has table named user which keep tracks of its users.<\/li>\r\n \t<li style=\"text-align: justify\">Show grant statement is used to view the privileges of the user.<\/li>\r\n \t<li style=\"text-align: justify\">Show grants [for user]<\/li>\r\n \t<li style=\"text-align: justify\">For User clause is skipped, then it shows grants for current user. show grants.<\/li>\r\n \t<li style=\"text-align: justify\">To view the grant of a user for specific user show grants for hj@localhost<\/li>\r\n<\/ul>\r\n<\/div>\r\n<strong>\u00a0 \u00a0Revoke Privilege<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\">Once users are created and privileges are granted to them, it may need to revoke privileges from a user. For example, if a user abuses his\/her privileges, it is required to revoke some or all privileges from the user.<\/li>\r\n \t<li style=\"text-align: justify\">The general syntax to revoke privileges is<\/li>\r\n<\/ul>\r\nrevoke &lt;privilegeslist&gt;\r\n\r\non [dbname.]tablename\r\n\r\nfrom username1 [,username2]\r\n<ul>\r\n \t<li style=\"text-align: justify\">For example, to revoke update and delete privileges from account database following code is written.<\/li>\r\n<\/ul>\r\nrevoke update,delete\r\n\r\non account.*\r\n\r\nfrom hj@localhost\r\n<ul>\r\n \t<li>To revoke all privileges, you must have the global create user privilege.<\/li>\r\n \t<li style=\"text-align: justify\">To revoke specific privileges, you must have the grant option privilege and you must have the privileges that you are revoking.<\/li>\r\n \t<li>Following example, demonstrate the use of revoke all.<\/li>\r\n<\/ul>\r\nrevoke all, grant option\r\n\r\nfrom hj@localhost\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>References:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">1. Luke Welling, Laura Thomson: PHP and MySQL Web Development, Pearson,<\/p>\r\n<p style=\"text-align: justify\">2. W. Jason Gilmore: Beginning PHP and MySQL 5 From Novice to Professional, Apress<\/p>\r\n<p style=\"text-align: justify\">3. Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass:Beginning PHP5, Apache, and MySQL Web Development, Wrox,<\/p>\r\n<p style=\"text-align: justify\">4. Robin Nixon: Learning PHP, MySQL, and JavaScript, O'Reilly Media<\/p>\r\n<p style=\"text-align: justify\">5. Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove: Professional PHP,Wrox<\/p>\r\n<p style=\"text-align: justify\">6. Tim Converse, Joyce Park, Clark Morgan: PHP5 and MySQL Bible<\/p>\r\n<p style=\"text-align: justify\">7. Joel Murach, Ray Harris: Murach\u2019s PHP and MySQL, Shroff\/Murach<\/p>\r\n<p style=\"text-align: justify\">8. Ivan Bayross, Web Enabled Commercial Application Development Using HTML\/Javascript\/DHTML\/PHP , BPB Publications<\/p>\r\n<p style=\"text-align: justify\">9. Joel Murach, \u201cMurach\u2019s MySQL\u201d, Shroff\/Murach<\/p>\r\n<p style=\"text-align: justify\">10. Julie C. Meloni, Sams Teach Yourself PHP, MySQL and Apache All in One, Sams<\/p>\r\n<p style=\"text-align: justify\">11. Larry Ullman, PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide, Pearson Education<\/p>\r\n<p style=\"text-align: justify\">12. http:\/\/www.php.net\/<\/p>\r\n<p style=\"text-align: justify\">13. http:\/\/www.w3schools.com\/<\/p>\r\n<p style=\"text-align: justify\">14. http:\/\/www.tutorialspoint.com\/<\/p>","rendered":"<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">MySQL is an open source relational database management system (RDBMS). As like other RDBMS, MySQL support to store and retrieve data. MySQL allows working multiple users simultaneously. It supports that only authorized users can access the data. MySQL uses the standard query language SQL (Structured Query Language). MySQL is considered as the world\u2019s most popular open source database.<\/p>\n<p>&nbsp;<\/p>\n<p>MySQL available under two license schemes.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">1. It can be available as open source license (GPL \u2013 General Public License)<\/p>\n<p>2. It can be purchased as commercial license.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Generally, PHP and MySQL are used to develop dynamic websites as both the soft wares are open source. Both these software work on majority of Operating Systems.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>MySQL strengths<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>MySQL has many strengths like<\/p>\n<ul>\n<li>Performance<\/li>\n<li>Portability<\/li>\n<li>Easy to learn<\/li>\n<li>Support for MySQL is available<\/li>\n<li>Low cost<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Work with MySQL<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">MySQL allows to work with GUI (Graphical User Interface) or command-line interface. To work with MySQL command line, there is option named MySQL console. MySQL console is available in MySQL menu of WAMP server from status bar.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As you click on MySQL, the server asks password. By Default, there is no password, so you need to just press the enter key.<\/p>\n<p>&nbsp;<\/p>\n<p>To login from another machine to MySQL type,<\/p>\n<p>&nbsp;<\/p>\n<p>Mysql \u2013h &lt;hostname&gt; -u &lt;username&gt;\u00a0 -p<\/p>\n<p>&nbsp;<\/p>\n<p>Where \u2013p means password.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To use MySQL in GUI, click phpMyAdmin menu of WAMP server from status bar. PhpMyAdmin is a web-based client of MySQL.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To work with MySQL, you should have access to MySQL. To access MySQL, the privilege should be assign to user. The user can access the MySQL by using username and password.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let us create a database named Account in MySQL. The database name is Account which having following tables.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff\">Vendor (vid, vname, vaddress, vcity,vmobile)<\/span><\/p>\n<\/div>\n<p><span style=\"color: #3366ff;text-align: initial;font-size: 1em\">\u00a0 \u00a0Invoice (iid,vid,inumber,idate,itotal,ptotal,ctotal,pdate)<\/span><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To create a database, create database statement is used. Following command create a database named account.<\/p>\n<p>&nbsp;<\/p>\n<p>Create database account<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To create a database only if it does not exist, if not exists clause is used with create database statement.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Create database if not exists account<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To select a database, use statement is used. For instance, to select account database you can write.<\/p>\n<p>&nbsp;<\/p>\n<p>use account<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To drop a database, drop database statement is used. For instance, to drop the database account<\/p>\n<p>&nbsp;<\/p>\n<p>Drop database account<\/p>\n<p>&nbsp;<\/p>\n<p>You can also check before drop database that the database exists.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Drop database if exists account<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Before drop database consult the database administration. In most case, though you will not have the privilege to do that.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We are using web-based client as it is easy to use. Of course, the user can use command-line interface in case he wants.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let us create a database using MySQL.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Start WAMP server. Then click on phpMyAdmin. Click on New button at the left side in the database tab. Then it will ask user to enter database name. Enter database name, optionally you can select collation and press the create button.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now on words for simplicity, I am using GUI to use MySQL. You can see the code that can be used with MySQL monitor (CUI \u2013 Character User Interface) in GUI.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Run phpMyAdmin from statusbar. Click on database tab. Enter the name of the database and click create button. You can choose any collation from the collation.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A collation is used to compare and sort character strings. It is a set of rules. Each collation is belonged to a single character set in MySQL. Every character set is belonged to minimum one collation. The Character set can be belonged two or more collations.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-218 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107.png\" alt=\"\" width=\"630\" height=\"305\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107.png 630w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107-300x145.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107-65x31.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107-225x109.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-107-350x169.png 350w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To create tables, in the database account, click on account and it will open options for creating tables in the database account. Enter table name and number of fields required in the table. To create vendor table enter vendor as table name and 5 in number of columns.click go button will open screen to create various filed of table account with its name, data type etc. Enter and select appropriate value for each column.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>MySQL datatypes<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">MySQL has nine most common data types. These data types divided into 3 groups : numeric, string and date\/time.<\/p>\n<p>&nbsp;<\/p>\n<p>The most common numeric data types are : INT, TINYINT and DECIMAL<\/p>\n<p>&nbsp;<\/p>\n<table class=\"aligncenter\">\n<tbody>\n<tr>\n<td style=\"width: 128.063px\"><strong>Data Type<\/strong><\/td>\n<td style=\"width: 515.063px\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 128.063px\" rowspan=\"3\">INT [(size)]<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/td>\n<td style=\"width: 515.063px\" rowspan=\"3\">INT (read as Integer) data type stores an integer number whose value<\/p>\n<p>between the -2147483648 and 2147483647. Size is the maximum display<\/p>\n<p>size. By default the size is 11.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 128.063px\" rowspan=\"2\">TINYINT [(size)]<\/p>\n<p>&nbsp;<\/td>\n<td style=\"width: 515.063px\" rowspan=\"2\">TINYINT data type stores an integer number whose value between -127 and<\/p>\n<p>128. Size is the maximum display size. By default size for TINYINT is 4.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 128.063px\" rowspan=\"3\">DECIMAL [(p [, s] )]<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/td>\n<td style=\"width: 515.063px\" rowspan=\"3\">Decimal data type stores decimal number with fixed precision and scale.<\/p>\n<p>Both precision and scale are optional. By default precision is 10 and scale is<\/p>\n<p>0.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The most common string data types are: VARCHAR, CHAR and TEXT<\/p>\n<ul>\n<li>By default, MySQL use Latin-1 character set.<\/li>\n<li>The Latin-1 character set provides 256 characters. Each character occupies 1 byte for storage.<\/li>\n<li style=\"text-align: justify\">The Unicode character set provides 65000+ characters. Each character generally use 2 bytes for storage.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<table class=\"aligncenter\">\n<tbody>\n<tr>\n<td><strong>Data Type<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\">VARCHAR (size)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"3\">Variable length characters. The size parameter represents maximum number<\/p>\n<p>of characters. The maximum number of characters stored by Varchar data<\/p>\n<p>type is 65535.<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">CHAR [(size)]<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"2\">Fixed length characters. The size parameter represents maximum number of<\/p>\n<p>Page 3 of 12<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>&nbsp;<\/p>\n<div>\n<table class=\"aligncenter\" style=\"width: 80%\">\n<tbody>\n<tr>\n<td rowspan=\"2\">&nbsp;<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"2\">characters. The maximum number of characters stored by char data type is<\/p>\n<p>255. By Default size is 1.<\/td>\n<\/tr>\n<tr>\n<td>Text<\/td>\n<td>Variable length characters. The maximum size is 65535 bytes.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center\">The most common date and time data types are: DATE, TIME and DATETIME<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-219 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108.png\" alt=\"\" width=\"633\" height=\"531\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108.png 633w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108-300x252.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108-65x55.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108-225x189.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-108-350x294.png 350w\" sizes=\"auto, (max-width: 633px) 100vw, 633px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">You can create vendor table by writing SQL statement in case you are not prefer to use GUI. The syntax for create table is<\/p>\n<p>&nbsp;<\/p>\n<p>create table<\/p>\n<p>( Columnname1 datatype [columnAttributes] ,<\/p>\n<p>Columnname2 datatype [columnAttributes] ,<\/p>\n<p>Columnname3 datatype [ColumnAttributes],<\/p>\n<p>)<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">To create vendor table you can code.<\/span><\/p>\n<\/div>\n<div>\n<p>\u00a0 \u00a0 create table vendor<\/p>\n<p>&nbsp;<\/p>\n<p>(vid int primary key auto_increment,<\/p>\n<p>&nbsp;<\/p>\n<p>vname varchar(50) unique,<\/p>\n<p>&nbsp;<\/p>\n<p>vaddress varchar(100),<\/p>\n<p>&nbsp;<\/p>\n<p>vcity varchar(50),<\/p>\n<p>&nbsp;<\/p>\n<p>vmobile varchar(11));<\/p>\n<p>&nbsp;<\/p>\n<p>SQL statement is terminated with semi-colon.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Attributes are like Primary Key, Foreign Key, Unique , Not Null, default and auto_increment. The 4 attributes &#8211; Primary Key, Foreign Key, Unique , Not Null &#8211; also known as constraint. Unique constraint ensures that the value for vname column contains unique value only. Null is a special value in SQL. Null is used when the value of a column is not known. Null is neither zero nor empty string. If you define column is not null then the column will not accept null value.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In a column more than one attribute can be added separated by space. In the previous example, vid is primary key and it has auto-increment attribute as well. Auto-increment adds value incremented by one as a new record inserted in the database.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">MySQL provides many type of storage engine like MyISAM, CSV, Memory, InnodB etc for table. The only InnoDB engine support referential integrity. So in a database, it is required to use foreign key, there must be InnoDB storage engine.<\/p>\n<p>&nbsp;<\/p>\n<p>SQL has mainly use for 4 types of languages:<\/p>\n<p>&nbsp;<\/p>\n<p>1. Data Definition Language (DDL)<\/p>\n<p>2. Data Manipulation Language (DML)<\/p>\n<p>3. Data Control Language (DCL)<\/p>\n<p>4.Data Transaction Language (DTL)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Data Definition:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">SQL lets a user define the structure and organization of the stored data and relationships among the stored data.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Data Manipulation:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">SQL allows a user or an application program to retrieve stored data from the database and use it. It also allows a user or an application program to add new data in the database, updating the previously stored data and removing stored data from the database.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">It is actually a CRUD operation as SQL allows user to Create(Add new data by using Insert command), Read (Retrieve data by using Select Command), Update (Update data by using update command) and Delete (Delete data by using delete command).<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Data Control:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>SQL can be used to provide access right and take it from user.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Data Transaction:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>SQL can be used to prevent certain kinds of database errors.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DDL Commands:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Create<\/p>\n<p>Alter<\/p>\n<p>Truncate<\/p>\n<p>Drop<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DML Commands:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Select<\/p>\n<p>Insert<\/p>\n<p>Update<\/p>\n<p>Delete<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DCL Commands:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Grant<\/p>\n<p>Revoke<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DTL\u00a0 Commands:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Commit<\/p>\n<p>Rollback<\/p>\n<p>Save Point<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">You should select the database , so the top-row of your phpMyAdmin will show server name and database name. For example,<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/localhost\/phpmyadmin\/index.php?token=c7840aa371e1726866a24b285c000b8c\">Server: mysql wampserver <\/a>\u00bb<a href=\"http:\/\/localhost\/phpmyadmin\/db_structure.php?db=account&amp;token=c7840aa371e1726866a24b285c000b8c\">Database: account.<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>To use the database in MySQL console mode, you should use<\/p>\n<p>&nbsp;<\/p>\n<p>Use\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;databaseName&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>statement.<\/p>\n<p>&nbsp;<\/p>\n<p>i.e. use account<\/p>\n<p>&nbsp;<\/p>\n<p>To view the list of tables of a database, you should code in MySQL console mode. Show tables;<\/p>\n<p>&nbsp;<\/p>\n<p>To view the structure of atbale, you should code<\/p>\n<p>&nbsp;<\/p>\n<p>Describe &lt;tablename&gt;;<\/p>\n<p>&nbsp;<\/p>\n<p>If you type, desc vendor;\u00a0 shows the schema\/structure of vendor table.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<p style=\"text-align: justify\">\u00a0 \u00a0 In phpMyAdmin you can also code by click on SQL tab and type the code. For example, in SQL tab you can type<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">desc vendor and click on the Go Button. Following figure shows it.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-220 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109.png\" alt=\"\" width=\"622\" height=\"240\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109.png 622w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109-300x116.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109-65x25.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109-225x87.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-109-350x135.png 350w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Alter table statement is used to<\/p>\n<ul>\n<li style=\"text-align: justify\">Add a new column at the end of the table or after a specified column<\/li>\n<li>Drop a column<\/li>\n<li>Rename a column<\/li>\n<li>modify the column of existing table<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">For example, to add the column vemail after vmobile column you can code<\/p>\n<p>&nbsp;<\/p>\n<p>alter table vendor<\/p>\n<p>&nbsp;<\/p>\n<p>add email varchar(50);<\/p>\n<p>&nbsp;<\/p>\n<p>To drop the column email, you can code<\/p>\n<p>&nbsp;<\/p>\n<p>alter table vendor<\/p>\n<p>&nbsp;<\/p>\n<p>drop column email;<\/p>\n<ul>\n<li style=\"text-align: justify\">Drop statement is used to drop the table or database also. To drop database , you can code Drop database account;<\/li>\n<li style=\"text-align: justify\">You should never drop the table or database without first consulting with database administrator.<\/li>\n<li style=\"text-align: justify\">Drop table statement deletes the definition and data of the table. Before drop the table, MySQL will check referential integrity. For example, you cannot delete vendor table if a foreign key in invoice table refers to the vendor table. In that case, you must first drop the invoice table before drop vendor able.<\/li>\n<li style=\"text-align: justify\">If the table does not exists, and you code drop table statement, then drop table statement generate an error. To prevent this error, you should code<\/li>\n<li style=\"text-align: justify\">Drop table if exists\u00a0 &lt;tablename&gt;<\/li>\n<\/ul>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial;font-size: 1em\">Indexes<\/strong><\/p>\n<div>\n<ul>\n<li style=\"text-align: justify\">An index facilitate RDBMS to go directly to a row rather than search through all the rows until found the specified searched one. Thus index speeds search.<\/li>\n<li style=\"text-align: justify\">By Default MySQL create index for primary key and unique constraint.<\/li>\n<li style=\"text-align: justify\">In RDBMS, it is required to create indexes for foreign key(s) and other column(s) which are used frequently in search condition or join tables. Index can be created for other columns. It is advisable to avoid to create index for columns which are updated frequently because it slows the insert, update and delete operation.<\/li>\n<li style=\"text-align: justify\">To create index, create index statement is used. The general syntax to create index is:<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>create [unique] index\u00a0 &lt;indexName&gt;<\/p>\n<p>on &lt;tableName&gt;\u00a0 (columnName1 [asc|desc] [,columnName2 [asc|desc])<\/p>\n<ul>\n<li>Unique keyword is used to specify that index contains only unique values.<\/li>\n<li>Asc or desc is used to specify that the index stored in ascending or descending sequence.<\/li>\n<li>An index can be created on one or more columns.<\/li>\n<li style=\"text-align: justify\">Index can be created when create table statement is used. In create table code index &lt;indexname&gt; (columnName&gt; after defining all the columns.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>For example, to create index on vcity column, code<\/p>\n<p>create index idxvcity<\/p>\n<p>on vendor (vcity)<\/p>\n<ul>\n<li>To drop an index drop index statement is used.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Users and Privileges<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\">The root user is automatically created when MySQL is installed. Root user is an administrative user who has all the privileges to perform any operation on any database on the server. So, root user can drop any table or database.<\/li>\n<li style=\"text-align: justify\">To prevent other users from either accidently or intentionally drop entire database or drop tables, other users created with fewer privileges than root user.<\/li>\n<li>The following four privileges allows the user to work with data which is stored in the table of database.<\/li>\n<li>Select<\/li>\n<li>Insert<\/li>\n<li>Update and<\/li>\n<li>Delete<\/li>\n<li>The following four privileges allows the user to modify the structure of the database\/table<\/li>\n<li>Create<\/li>\n<li>Alter<\/li>\n<li>drop and<\/li>\n<li>Index.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Following table shows other privileges<\/p>\n<\/div>\n<div>\n<table class=\"aligncenter\">\n<tbody>\n<tr>\n<td><strong>Privileges<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">All\u00a0 [privileges]<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"2\">All privileges available at the current level. It does<\/p>\n<p>not include Grant Option privilege.<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">Grant\u00a0 Option<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"2\">Allows a user to grant privilege available to his\/her<\/p>\n<p>to other users.<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">Usage<\/p>\n<p>&nbsp;<\/td>\n<td rowspan=\"2\">No privileges. It is used to modify existing accounts<\/p>\n<p>without changing privileges for that account.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li style=\"text-align: justify\">MySQL assign privileges at four different levels. These four levels are:Global, Database, Table and column. The asterisk (*) is used as wild card character to indicate all.<\/li>\n<\/ul>\n<table class=\"aligncenter\" style=\"height: 196px\">\n<tbody>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 62.0625px\"><strong>Level<\/strong><\/td>\n<td style=\"height: 28px;width: 160.063px\"><strong>Example<\/strong><\/td>\n<td style=\"height: 28px;width: 212.063px\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 62.0625px\">Global<\/td>\n<td style=\"height: 28px;width: 160.063px\">*.*<\/td>\n<td style=\"height: 28px;width: 212.063px\">All databases and all table<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 62.0625px\" rowspan=\"2\">Database<\/p>\n<p>&nbsp;<\/td>\n<td style=\"height: 28px;width: 160.063px\" rowspan=\"2\">account.*<\/p>\n<p>&nbsp;<\/td>\n<td style=\"height: 28px;width: 212.063px\" rowspan=\"2\">All tables of the account<\/p>\n<p>(specified) database.<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 62.0625px\">Table<\/td>\n<td style=\"height: 28px;width: 160.063px\">account.vendor<\/td>\n<td style=\"height: 28px;width: 212.063px\">All columns of the vendor table.<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 62.0625px\" rowspan=\"2\">Column<\/p>\n<p>&nbsp;<\/td>\n<td style=\"height: 28px;width: 160.063px\" rowspan=\"2\">(vname) account.vendor<\/p>\n<p>&nbsp;<\/td>\n<td style=\"height: 28px;width: 212.063px\" rowspan=\"2\">Only vname (specified)<\/p>\n<p>column(s)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li style=\"text-align: justify\">MySQL has many privileges. For complete list of privileges, you can refer MySQL reference manual. MySQL reference manual is available online. You can search privileges at MySQL manual by typing \u201cprivileges provided\u201d.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Create , rename and drop user<\/strong><\/p>\n<ul>\n<li>create user statement is used to create a new user.<\/li>\n<li>The general syntax to create user is:<\/li>\n<li>create user &lt;username&gt;\u00a0 [@hostname]<\/li>\n<li>identified by\u00a0 \u2018&lt;password&gt; \u2018<\/li>\n<li>For example,<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>create user hiren@localhost<\/p>\n<p>identified by &#8216;hiren&#8217;;<\/p>\n<ul>\n<li style=\"text-align: justify\">If the hostname is not specified, MySQL uses % as a wild card character to indicate that the user can be from any host.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>create user hiren<\/p>\n<p>identified by &#8216;hiren&#8217;;<\/p>\n<ul>\n<li style=\"text-align: justify\">It is recommended that you should specify host when create a user.<\/li>\n<li style=\"text-align: justify\">Username must be unique for the host. For instance, I cannot create user hiren@localhost as the user hiren exists at localhost.<\/li>\n<li style=\"text-align: justify\">Rename user statement is used to change the name of user. If the original user has privileges, these privileges are transferred to the new name.<\/li>\n<\/ul>\n<\/div>\n<div>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0rename user hiren to hdj@localhost;<\/p>\n<ul>\n<li style=\"text-align: justify\">To change, password of a user, grant usage statement is used. o\u00a0 For example, to change password for hdj@localhost<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>grant usage on *.*<\/p>\n<p>to hdj@localhost<\/p>\n<p>identified by &#8216;hdj@localhost&#8217;;<\/p>\n<ul>\n<li style=\"text-align: justify\">To drop user, drop user statement is used. o F<\/li>\n<li style=\"text-align: justify\">.or example, to drop hdj@localhost<\/li>\n<\/ul>\n<p>drop user hdj@localhost;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Grant Privileges<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\">Before you grant privileges, you must connect as an appropriate user.<\/li>\n<li style=\"text-align: justify\">Root user has all the necessary privileges to grant privileges to another user.<\/li>\n<li>The general syntax for grant privilege is:<\/li>\n<\/ul>\n<p>Grant\u00a0 &lt;privilege(s)&gt;<\/p>\n<p>On [dbname].table<\/p>\n<p>To username1 [identified by \u2018password1\u2019] [,<\/p>\n<p>username2 [identified by \u2018password2\u2019]\u2026]<\/p>\n<p>[with grant option]<\/p>\n<ul>\n<li style=\"text-align: justify\">In case dbname (databasename) is not specified, MySQL uses the current database.<\/li>\n<li style=\"text-align: justify\">With grant option allows the user to grant the privileges for that user to other users.<\/li>\n<li style=\"text-align: justify\">To grant select privilege to hiren@localhost for the account database<\/li>\n<\/ul>\n<p style=\"text-align: justify\">\n<p>grant select<\/p>\n<p>on account.*<\/p>\n<p>to hiren@localhost;<\/p>\n<ul>\n<li style=\"text-align: justify\">To grant insert, update and delete privileges to hiren@localhost for the account database<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>grant insert, update , delete<\/p>\n<p>on account.*<\/p>\n<p>to hiren@localhost;<\/p>\n<ul>\n<li style=\"text-align: justify\">Generally, create user statement is used to create user and grant statement is used to assign grant to the user. MySQL allows using grant statement to create users and grant privileges in a single statement. For example<\/li>\n<\/ul>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Following grant statement create two users hj@localhost and hirenj@localhost and grants select, insert, update and delete on account database.<\/p>\n<p>&nbsp;<\/p>\n<p>grant select,insert, update, delete<\/p>\n<p>on account.*<\/p>\n<p>to hj@localhost identified by &#8216;hj@localhost&#8217;,<\/p>\n<p>hirenj@localhost identified by &#8216;hirenj@localhost&#8217;;<\/p>\n<ul>\n<li style=\"text-align: justify\">The following example shows how to grant privileges for specific columns. The below code allows select privileges for two columns vid and vname and allows update privilege for vaddress column.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>grant select(vid, vname), update (vaddress)<\/p>\n<p>on account.vendor<\/p>\n<p>to hj@localhost<\/p>\n<ul>\n<li>To assign all the privileges, all keyword is used.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>grant all<\/p>\n<p>on *.*<\/p>\n<p>to dba<\/p>\n<p>with grant option<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>View privileges<\/strong><\/p>\n<ul>\n<li>To list all the users of current server, you can use select statement as shown below.<\/li>\n<\/ul>\n<p>select user, host<\/p>\n<p>from mysql.user<\/p>\n<ul>\n<li style=\"text-align: justify\">MySQL uses an internal database mysql. This database has table named user which keep tracks of its users.<\/li>\n<li style=\"text-align: justify\">Show grant statement is used to view the privileges of the user.<\/li>\n<li style=\"text-align: justify\">Show grants [for user]<\/li>\n<li style=\"text-align: justify\">For User clause is skipped, then it shows grants for current user. show grants.<\/li>\n<li style=\"text-align: justify\">To view the grant of a user for specific user show grants for hj@localhost<\/li>\n<\/ul>\n<\/div>\n<p><strong>\u00a0 \u00a0Revoke Privilege<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\">Once users are created and privileges are granted to them, it may need to revoke privileges from a user. For example, if a user abuses his\/her privileges, it is required to revoke some or all privileges from the user.<\/li>\n<li style=\"text-align: justify\">The general syntax to revoke privileges is<\/li>\n<\/ul>\n<p>revoke &lt;privilegeslist&gt;<\/p>\n<p>on [dbname.]tablename<\/p>\n<p>from username1 [,username2]<\/p>\n<ul>\n<li style=\"text-align: justify\">For example, to revoke update and delete privileges from account database following code is written.<\/li>\n<\/ul>\n<p>revoke update,delete<\/p>\n<p>on account.*<\/p>\n<p>from hj@localhost<\/p>\n<ul>\n<li>To revoke all privileges, you must have the global create user privilege.<\/li>\n<li style=\"text-align: justify\">To revoke specific privileges, you must have the grant option privilege and you must have the privileges that you are revoking.<\/li>\n<li>Following example, demonstrate the use of revoke all.<\/li>\n<\/ul>\n<p>revoke all, grant option<\/p>\n<p>from hj@localhost<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>References:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">1. Luke Welling, Laura Thomson: PHP and MySQL Web Development, Pearson,<\/p>\n<p style=\"text-align: justify\">2. W. Jason Gilmore: Beginning PHP and MySQL 5 From Novice to Professional, Apress<\/p>\n<p style=\"text-align: justify\">3. Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass:Beginning PHP5, Apache, and MySQL Web Development, Wrox,<\/p>\n<p style=\"text-align: justify\">4. Robin Nixon: Learning PHP, MySQL, and JavaScript, O&#8217;Reilly Media<\/p>\n<p style=\"text-align: justify\">5. Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove: Professional PHP,Wrox<\/p>\n<p style=\"text-align: justify\">6. Tim Converse, Joyce Park, Clark Morgan: PHP5 and MySQL Bible<\/p>\n<p style=\"text-align: justify\">7. Joel Murach, Ray Harris: Murach\u2019s PHP and MySQL, Shroff\/Murach<\/p>\n<p style=\"text-align: justify\">8. Ivan Bayross, Web Enabled Commercial Application Development Using HTML\/Javascript\/DHTML\/PHP , BPB Publications<\/p>\n<p style=\"text-align: justify\">9. Joel Murach, \u201cMurach\u2019s MySQL\u201d, Shroff\/Murach<\/p>\n<p style=\"text-align: justify\">10. Julie C. Meloni, Sams Teach Yourself PHP, MySQL and Apache All in One, Sams<\/p>\n<p style=\"text-align: justify\">11. Larry Ullman, PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide, Pearson Education<\/p>\n<p style=\"text-align: justify\">12. http:\/\/www.php.net\/<\/p>\n<p style=\"text-align: justify\">13. http:\/\/www.w3schools.com\/<\/p>\n<p style=\"text-align: justify\">14. http:\/\/www.tutorialspoint.com\/<\/p>\n","protected":false},"author":3,"menu_order":21,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-hiren-joshi"],"pb_section_license":""},"chapter-type":[],"contributor":[59],"license":[],"class_list":["post-215","chapter","type-chapter","status-publish","hentry","contributor-dr-hiren-joshi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"count":5,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/215\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/215\/revisions\/416"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/215\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapter-type?post=215"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/contributor?post=215"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/license?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}