sql语句使用-插入列与连接查询

本文介绍如何通过SQL语句向现有表中添加新列,并演示了如何执行内连接查询来从多个表中获取数据。包括具体示例,如在表中添加带有特定数据类型的列,以及如何通过连接操作整合不同表中的数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

表中插入一列:
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值