Home  >  Article  >  Backend Development  >  sql statement in php

sql statement in php

不言
不言Original
2018-04-19 09:17:316320browse

This article mainly introduces the sql statements in php. Now I will share it with you and give you a reference. Let’s follow the editor and take a look.

Enter mysql;

In cmd

net start mysql;//Start the mysql service

net stop mysql ;//Close the mysql service
mysql -uroot -hlocalhost -p;//Enter mysql
create database database name;//Create database
show databases;//Display data
show columns from table name (from database name); //Do not need table
describe(dec) table name column name; //Do not need table
use database name;//Use the current Database
create table table name (column name attribute, column name attribute,...);
alter table table name add (column name attribute, column name attribute,...);
rename table name 1 to table name 2;
mysql statement operation;
Add record:
insert into table name(column name 1, column name 2,..)values(value1,value2...);
Query records:
select (column name 1, column name 2, ..) from table name where constraints;
Modify records:
update table name set column name 1=newvalue1, column name 2= newvalue2 where constraint;
Delete record:
delete from database name where constraint;
backup of database;
mysqldump --no-defaults -uroot -p database name>The location to be placed

Related recommendations:

Detailed explanation of the usage and examples of foreach in PHP

Using uuid in PHP

The above is the detailed content of sql statement in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn