Method 1:
distinct
select count(distinct CName) from Course
Method two:
Using grouping group by
select count(1) from Course group by CName
Introduction to database
1concept
3 relational database in Song Dynasty (pure theory)
Relational database is the use of Microsoft Corp)
noSQL
MangoDB,Redis
5sqlbrief introduction
Structure Query Language >:
client partmysql.exe” document, the operating environment iscmd > port number-u localhost” means the machine. 127.0.0.1” means the machine. If it is the machine, it can be omitted.
-P default, it can be omitted.
-u >root
DB DataBase ( corresponds to the form in reality.)
Record
>.
> Library option.
explains:
> is used to set the stored character...
This section focuses on:
How to find out the relationship between two tables
Three relations of tables
1. Introduction
Because of the constraint of foreign key, the two tables form three relationships:
Multi to one
Multiple to many
One-on-one
Two, focus on understanding if you find out the relationship between the two tables.
Three, three relationships of tables
(1)Books and publishers
One to many (or many to one): a publishing house can publish many books. Look at the picture and talk.
Association mode: foreign key
create table press(
id int primary k...