更新时间:2021-09-03 09:14:26
取决于你是在谈论三行还是三列。答案可能会根据您的需要而改变。我会回答两个值,你想要选择一个列,或者你想选择一行(包括所有列)。
如果你想选择只有一列,然后在SELECT语句中写入列名。
Depends on whether you are talking about three rows or three columns. The answer may alter as per your need. I would answer both values, in which you want to either select a column, or you want to select one row (with all columns).
If you want to select only one column, then write the column name in the SELECT statement.
SELECT column_name FROM table_name
这将只选择一列,而不是所有列( *
)。
如果要选择一行,可以使用 TOP
子句选择一条记录,
This would select only one column, instead of all columns (*
).
If you want to select one row, you can use TOP
clause to select one record,
SELECT TOP 1 * FROM table_name
上面的代码具有相同的所有行( *
)但只有一条记录,即前一条记录。要选择哪一个,可以使用ORDER BY或DESC或其他子句来改变结果。
The above code has same all rows (*
) but only one record, the top one. To select which one, you can use ORDER BY or DESC or other clauses to alter the results.