SQL Server:SQL 查询与一般编程的比较
我刚刚开始使用 SQL Server 2008 Express,并花了大约一个小时尝试一些基本查询。 SQL 脚本(正确的术语?)与一般计算机编程相比如何?编写 SQL 查询是否像软件开发一样复杂、需要长时间学习、需要大量练习等?编写高级 SQL 查询是否可以与软件开发相媲美,至少在某种程度上是这样,如果可以,您能解释一下吗?
另外,我找到了一些用于学习 SQL 的教程和参考网站,但您是否也可以推荐一些其他网站。
另外(2),我正在使用 SQL Server 中的 SQL 查询设计器,它似乎是学习编写 SQL 命令的好工具,但是有没有办法使用设计器来插入数据。看来它只适用于 SELECT 数据。
任何其他有关学习、更好地理解 SQL 等的一般性评论将不胜感激。谢谢
I'm just starting out with SQL Server 2008 Express and spent the last hour or so trying out some basic queries. How does SQL scripting (correct term?) compare to general computer programming? Is writing SQL queries as involved, lengthy to learn, needs as much practice, etc. as software development? Is writing advanced SQL queries comparable to software development, at least to some degree, and if so could you explain that?
Also, I found a couple of tutorial and reference sites for learning SQL but could you also recommend some other sites.
Also(2), I was playing around with the SQL query designer in SQL Server and it seems like a good tool to learn writing SQL commands, but is there a way to use the designer to INSERT data. it seems that it's only for SELECT ing data.
Any other general comments for learning, better understanding, etc SQL would be appreciated. thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQL 是一种声明性语言,它主要处理集合。
因此它与过程语言非常不同。
我想说它介于 过程语言 和 函数式语言在风格方面。
我会推荐 Joe Celko 的书,这本由 Hernandez,以及 鲍曼。
在 SSMS 中,您可以将数据粘贴到表中(通常来自 Excel)。
通常没有用户通过 SSMS 输入数据,通常使用 SSIS 等工具加载数据。
可以使用INSERT INTO tbl VALUES(x,y,z)来INSERT数据,SQL Server 2008通过行构造函数具有多行插入能力:INSERT INTO tbl VALUES(x,y,z),(a,b,c )
SQL is a declarative language and it primarily deals with sets.
As such it it very different from procedural languages.
I would say it is somewhere between procedural languages and functional languages in terms of style.
I would recommend Joe Celko's books, this one by Hernandez, and this one by Bowman.
In SSMS, you can paste data into a table (usually from Excel).
Typically no users enter data through SSMS, usually loading data using a tool like SSIS.
You can INSERT data using INSERT INTO tbl VALUES (x, y, z), and SQL Server 2008 has a multi-row insertion ability through row constructors: INSERT INTO tbl VALUES (x, y, z), (a, b, c)
凯德的回答很好。我想补充一点,(高级)SQL 是一种稍微不同的思维方式 - 实际上,您可以使用集合(如果您愿意,请查看数学手册以了解基础知识)。可以生成非常高级的 SQL 查询,从而产生非常复杂的集合,但通常您会发现在某些时候需要存储过程(即使只是为了易读)。一旦达到这一点,它就变得更像传统编程了。
Cade's answer is good. I'd like to add that (advanced) SQL is a slightly different mindset - one where you play with sets, indeed (check out mathematics manuals for the basics, if you like). It's possible to generate really advanced SQL queries, resulting in very complex sets, but often you'll find you'll want a stored procedure at some point (even if just for legibility). Once you're at that point, it becomes much more like traditional programming.