sql语句使用-插入列与连接查询
2017-03-29 16:41
441 查看
表中插入一列:
alter table 表名 add 列名 数据类型
如:alter table student add nickname char(20)
alter table [bitcoin].[dbo].[CoinbaseTransaction] add [OutputValueBtc] numeric(20,8)
执行插入语句后,不会像使用直接增加列一样,出现列无效的问题。
连接:
mysql> SELECT a.runoob_id, a.runoob_author, b.runoob_count FROM runoob_tbl a INNER JOIN tcount_tbl b ON a.runoob_author = b.runoob_author;
insert CoinbaseTransaction
SELECT [bitcoin].[dbo].[TransactionOutput].[OutputValueBtc]
,[bitcoin].[dbo].[TransactionOutput].[OutputScript]
,[bitcoin].[dbo].[TransactionOutput].[OutputIndex]
FROM [bitcoin].[dbo].[TransactionOutput]
INNER JOIN [CoinbaseTransaction] on [bitcoin].[dbo].[TransactionOutput].[BitcoinTransactionId] = [bitcoin].[dbo].[CoinbaseTransaction].[BitcoinTransactionId]
【1】参考链接:
http://www.runoob.com/mysql/mysql-join.html
alter table 表名 add 列名 数据类型
如:alter table student add nickname char(20)
alter table [bitcoin].[dbo].[CoinbaseTransaction] add [OutputValueBtc] numeric(20,8)
执行插入语句后,不会像使用直接增加列一样,出现列无效的问题。
连接:
mysql> SELECT a.runoob_id, a.runoob_author, b.runoob_count FROM runoob_tbl a INNER JOIN tcount_tbl b ON a.runoob_author = b.runoob_author;
insert CoinbaseTransaction
SELECT [bitcoin].[dbo].[TransactionOutput].[OutputValueBtc]
,[bitcoin].[dbo].[TransactionOutput].[OutputScript]
,[bitcoin].[dbo].[TransactionOutput].[OutputIndex]
FROM [bitcoin].[dbo].[TransactionOutput]
INNER JOIN [CoinbaseTransaction] on [bitcoin].[dbo].[TransactionOutput].[BitcoinTransactionId] = [bitcoin].[dbo].[CoinbaseTransaction].[BitcoinTransactionId]
【1】参考链接:
http://www.runoob.com/mysql/mysql-join.html
相关文章推荐
- MySQL5.7性能优化系列(二)——SQL语句优化(2)——使用 Semi-Join半连接变换优化子查询,派生表和视图
- Oracle_学习使用SQL语句六(连接查询)
- 26. SQL -- TSQL(SELECT语句的使用,子查询,连接,通配符 )(2)
- C#下使用sql语句查询,插入,更新,删除
- oracle12c JSON数据 使用SQL语句实现多表左外连接 显示无效数据 分页查询
- SQL查询语句精华使用简要----关于连接
- 在C#下使用sql语句(查询,插入,更新,删除……)
- 27. SQL -- TSQL(SELECT语句的使用,子查询,连接,通配符 )(3)
- SQL查询语句使用
- SQL查询语句使用方法参考二
- SQL查询语句精华使用简要
- SQL查询语句使用简要
- SQL查询语句精华使用简要
- 在Delphi中使用SQL语句插入包括时间日期的记录
- 数据库知识-SQL查询语句精华使用简要
- SQL查询语句精华使用简要
- ADO带密码的数据连接、查询一个记录集、执行一SQL语句
- 数据库知识—SQL查询语句精华使用简要
- SQL查询语句使用
- 数据库知识—SQL查询语句精华使用简要