SQL SELECT INTO 语句可用于创建表的备份复件。 SELECT INTO 语句 SELECT INTO 语句从一个表中选取数据,然后把数据插入另一个表中。 SELECT INTO 语句常用于创建表的备份复件或者用于对记录进行存档。 SQL SELECT INTO 语法 您可以把所有的列插入新表: SELECT * INTO new_table_name FROM old_tablename 或者只把希望的列插入新表: SELECT column_name(s) INTO new_table_name FROM old_tablename SQL SELECT INTO 实例 - 制作备份复件 下面的例子会制作 Persons 表的备份复件: SELECT * INTO Persons_backup FROM Persons IN 子句可用于向另一个数据库中拷贝表: SELECT * INTO Persons IN 'Backup.mdb' FROM Persons 如果我们希望拷贝某些域,可以在 SELECT 语句后列出这些域: SELECT LastName,FirstName INTO Persons_backup FROM Persons SQL SELECT INTO 实例 - 带有 WHERE 子句 我们也可以添加 WHERE 子句。 下面的例子通过从 Persons 表中提取居住在 Beijing 的人的信息,创建了一个带有两个列的名为 Persons_backup 的表: SELECT LastName,Firstname INTO Persons_backup FROM Persons WHERE City='Beijing' SQL SELECT INTO 实例 - 被连接的表 从一个以上的表中选取数据也是可以做到的。 下面的例子会创建一个名为 Persons_Order_Backup 的新表,其中包含了从 Persons 和 Orders 两个表中取得的信息: SELECT Persons.LastName,Orders.OrderNo INTO Persons_Order_Backup FROM Persons INNER JOIN Orders ON Persons.Id_P=Orders.Id_P
SELECT DISTINCT 语句 去除重复值。 关键词 DISTINCT 用于返回唯一不同的值。 语法:SELECT DISTINCT 列名称 FROM 表名称 使用 DISTINCT 关键词 如果要从 Company 列中选取所有的值,我们需要使用 SELECT 语句: SELECT Company FROM OrdersOrders表: Company OrderNumber IBM 3532 W3School 2356 Apple 4698 W3School 6953 结果: Company IBM W3School Apple W3School 请注意,在结果集中,W3School 被列出了两次。 如需从 Company 列中仅选取唯一不同的值,我们需要使用 SELECT DISTINCT 语句: SELECT DISTINCT Company FROM Orders 结果: Company IBM W3School Apple 现在,在结果集中,W3School 仅被列出了一次。
注释: SQL 语句对大小写不敏感。 SQL SELECT 语句 SELECT 语句用于从表中选取数据,结果被存储在一个结果表中(称为结果集)。 SQL SELECT 语法SELECT 列名称 FROM 表名称 以及: SELECT * FROM 表名称 SELECT 等效于 select。 提示: 星号(*)是选取所有列的快捷方式。 SQL SELECT 实例 如需获取名为 LastName 和 FirstName 的列的内容(从名为 Persons 的数据库表),请使用类似这样的 SELECT 语句: SELECT LastName,FirstName FROM Persons Persons 表: Id LastName FirstName Address City 1 Adams John Oxford Street London 2 Bush George Fifth Avenue New York 3 Carter Thomas Changan Street Beijing 结果: LastName FirstName Adams John Bush George Carter Thomas SQL SELECT * 实例 现在我们希望从 Persons 表中选取所有的列。 请使用符号 * 取代列的名称,就像这样: SELECT * FROM Persons 结果: Id LastName FirstName Address City 1 Adams John Oxford Street London 2 Bush George Fifth Avenue New York 3 Carter Thomas Changan Street Beijing
Evolution tells WHY, not that what it right, what is wrong, or how you should do. In order to avoid misleading interpretation, this message is in ugly English again. Sorry, some may construe what I am saying as a judgement of daily life. No, this is only an academic analysis for those who are really interested in this topic. If a male says that "I am a very nice person except that I am easy to get angry", he may be really a nice person. What do I mean by "nice person"? It is from the point of view of "relationships", or put it clearly, a sexual partner. Then, if a female utters the same declaration, is she a "nice person"? This is the key question of this post. Behaviorally and psychologically, anger is a masculine character, it is a sign, or a tool, of dominance. How do you express your anger in front of the guy that is more dominant than you? Anger is a aggressive signal, it often relates to competition and fight, if you are not strong enough, you are not "qualified" to be angry. In fairness to the "angry female", anger is not such a bad thing, she may be more successful in commercial or political circumstances. AND, it may be good to her children, she may have a full control to her children, and can manage them well in studying, achieving good school scores. BUT, there is no school or piano in the far past when human mental essentials evolved. In millions of years of prehistory, children did not go to school, they did not play pianos. In those old days, children grew naturally in the wild, they needed their mothers care, not control. In particular, too many restrictions and control are very harmful to their psychological development, they will have less competitive advantage when they reach adult ages. From the point of view of a male, when he chooses sexual partner, he is choosing a would-be mother of his future children. This is a basic assumption of sexual select. If his partner is dominance, arrogant and quick-tempered, it is very probable that he will have a very submissive son. In this vein, it is really a problem of "sexy son". For females, "sexy son" is a good gene, but the other side of the coin is to some extent controlled by herself. Furthermore, human newborns are extremely altricial, they are born helpless, so the male should seek a SOFT and NUTRITIOUS container, the container is his wife. What is SOFT here? It is fat(are you scoffing? have a look at my book "THE UGLY PEACOCK"), it is a good temper. Dou you know what happened to Mr Liubei when he was angry? Joke;) If there is a male whose only emotion is anger, this may not be a bad thing. Many strong figures in movies is something like this. Studies show that although females may prefer happy guys, but for short-term relationship, females often prefer "angry" guys:( -------- New term starts soon, this is the end of the vacation post sequel...