Bagikan melalui


project operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Pilih kolom yang akan disertakan, ganti nama atau jatuhkan, dan sisipkan kolom baru yang dikomputasi.

Urutan kolom dalam hasil ditentukan oleh urutan argumen. Hanya kolom yang ditentukan dalam argumen yang disertakan dalam hasil. Kolom lain dalam input dihilangkan.

Syntax

T| project [ColumnName | (ColumnName[,])=] Expression [, ...]

or

T| projectColumnName [=Expression] [, ...]

Learn more about syntax conventions.

Parameters

Name Type Required Description
T string ✔️ Input tabular untuk memproyeksikan kolom tertentu.
ColumnName string Nama kolom atau daftar nama kolom yang dipisahkan koma untuk muncul dalam output.
Expression string Ekspresi skalar untuk dilakukan melalui input.
  • Either ColumnName or Expression must be specified.
  • If there's no Expression, then a column of ColumnName must appear in the input.
  • If ColumnName is omitted, the output column name of Expression will be automatically generated.
  • If Expression returns more than one column, a list of column names can be specified in parentheses. If a list of the column names isn't specified, all Expression's output columns with generated names will be added to the output.

Note

Tidak disarankan untuk mengembalikan kolom terhitung baru dengan nama yang sama dengan kolom yang ada dalam input.

Returns

Tabel dengan kolom yang diberi nama sebagai argumen. Berisi jumlah baris yang sama dengan tabel input.

Examples

Contoh di bagian ini memperlihatkan cara menggunakan sintaks untuk membantu Anda memulai.

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. Anda mungkin perlu mengubah nama tabel dalam contoh kueri agar sesuai dengan tabel di ruang kerja Anda.

Hanya perlihatkan kolom tertentu

Hanya tampilkan EventId, State, EventType dari StormEvents tabel .

StormEvents
| project EventId, State, EventType

Output

Tabel memperlihatkan 10 hasil pertama.

EventId State EventType
61032 ATLANTIC SOUTH Waterspout
60904 FLORIDA Heavy Rain
60913 FLORIDA Tornado
64588 GEORGIA Thunderstorm Wind
68796 MISSISSIPPI Thunderstorm Wind
68814 MISSISSIPPI Tornado
68834 MISSISSIPPI Thunderstorm Wind
68846 MISSISSIPPI Hail
73241 AMERICAN SAMOA Flash Flood
64725 KENTUCKY Flood
... ... ...

Manipulasi potensial menggunakan proyek

Kueri berikut mengganti nama BeginLocation kolom dan membuat kolom baru yang disebut TotalInjuries dari perhitungan atas dua kolom yang sudah ada.

StormEvents
| project StartLocation = BeginLocation, TotalInjuries = InjuriesDirect + InjuriesIndirect
| where TotalInjuries > 5

Output

Tabel memperlihatkan 10 hasil pertama.

StartLocation TotalInjuries
LYDIA 15
ROYAL 15
GOTHENBURG 9
PLAINS 8
KNOXVILLE 9
CAROL STREAM 11
HOLLY 9
RUFFIN 9
ENTERPRISE MUNI ARPT 50
COLLIERVILLE 6
... ...