데이터 베이스 MySQL 튜토리얼 PHP学习之SQL语句快速入门

PHP学习之SQL语句快速入门

Jun 07, 2016 pm 06:02 PM
SQL 문

在学校php过程中,需要用得到的一些语句。比较简单的大家一定要掌握

Select * from tablename
SQL> select * from employees;
Select select list from tablename
SQL> select employee_id,first_name from employees;
Select distinct … from tablename
SQL> select distinct manager_id from employees;
||连接符使用以及 加减乘除以及括号的使用
SQL> select employee_id,first_name||'.'||last_name,salary*(1+0.1)/100,manager_id
2 from employees;
+-做正负号使用
SQL> select -salary from employees;
,>,SQL> select * from employees where salary >13000;
SQL> select * from employees where salary SQL> select * from employees where salary 13000;
SQL> select * from employees where salary =13000;
In
SQL> select -salary from employees where employee_id in (100,101,102);
SQL> select -salary from employees where employee_id in (select employee_id from employees);
not in
SQL> select -salary from employees where employee_id not in (100,101,102);
Any(比任意一个都)
select * from employees where employee_id >any(100,101,102);
some 是 SQL-92 标准的 any 的等效物
select * from employees where employee_id >any(100,101,102);
all(比所有的都)
select * from employees where employee_id >all(100,101,102);
between and
select * from employees where employee_id between 100 and 102;
not between and
select * from employees where employee_id not between 100 and 102;
逻辑操作符
And 和 or
select * from employees where employee_id > 100 and employee_id select * from employees where employee_id > 100 or employee_id Order by
Desc
select * from employees where employee_id between 100 and 102 order by employee_id desc;
Asc
select * from employees where employee_id between 100 and 102 order by employee_id asc;
dual哑元表没有表需要查询的时候可以用它
select sysdate from dual;
select 1*2*3*4*5 from dual;
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Excel에서 iif 함수를 사용하는 방법 Excel에서 iif 함수를 사용하는 방법 Mar 20, 2024 pm 06:10 PM

Excel에서 iif 함수를 사용하는 방법

Oracle 데이터베이스 로그를 쿼리하는 방법 Oracle 데이터베이스 로그를 쿼리하는 방법 Apr 07, 2024 pm 04:51 PM

Oracle 데이터베이스 로그를 쿼리하는 방법

sql 문을 사용하여 mysql 데이터베이스의 저장 구조를 쿼리하는 방법 sql 문을 사용하여 mysql 데이터베이스의 저장 구조를 쿼리하는 방법 Apr 14, 2024 pm 07:45 PM

sql 문을 사용하여 mysql 데이터베이스의 저장 구조를 쿼리하는 방법

navicat에서 쿼리된 데이터를 내보내는 방법 navicat에서 쿼리된 데이터를 내보내는 방법 Apr 24, 2024 am 04:15 AM

navicat에서 쿼리된 데이터를 내보내는 방법

mysql 데이터베이스 초기화 실패를 해결하는 방법 mysql 데이터베이스 초기화 실패를 해결하는 방법 Apr 14, 2024 pm 07:12 PM

mysql 데이터베이스 초기화 실패를 해결하는 방법

mysql 데이터베이스에서 sql 문을 실행하는 방법 mysql 데이터베이스에서 sql 문을 실행하는 방법 Apr 14, 2024 pm 07:48 PM

mysql 데이터베이스에서 sql 문을 실행하는 방법

MySQL 트랜잭션 처리: 자동 제출과 수동 제출의 차이점 MySQL 트랜잭션 처리: 자동 제출과 수동 제출의 차이점 Mar 16, 2024 am 11:33 AM

MySQL 트랜잭션 처리: 자동 제출과 수동 제출의 차이점

MySQL 뷰의 장점과 한계 MySQL 뷰의 장점과 한계 Mar 15, 2024 pm 09:09 PM

MySQL 뷰의 장점과 한계

See all articles