search
HomeDatabaseMysql Tutorial精通数据库系列之入门-技巧篇3_MySQL

精通数据库系列之入门-技巧篇3_MySQL

Jun 01, 2016 pm 02:05 PM
sqlgetting StartedSkilldatabaseproficientseries

作者:思索 整理:南海

  下面,笔者还为各位网友准备了一套数据库大餐,这就是在

MS-SQL Server下的Client/Server结构编程示例:  

  MS-SQL SERVER是微软公司生产的中型关系数据库管理系统,它有如下的一些特点:

客户/服务器体系结构
图形化的用户界面,使系统的管理更加直观和简单。
丰富的编程接口,为用户进行应用程序设计提供了更大的选择余地。
与Windows NT操作系统的有机集成,多线程体系结构设计,提高了系统对用户并发访问的速度。
对Web技术的支持,使用户能够很容易的将数据库中的数据发布到网上。
价格上的优势。与其它一些大型数据库系统如Oracle、Sybase等相比,SQL Server的价格非常便宜。
  由于SQL Server数据库管理系统具有突出的有点,所以其用户越来越多。本文中陈述的是一些使用SQL Server的方法和体会(以SQL Server6.5为例)。  

一、系统的安装

  SQL Server要求安装在Windows NT操作系统平台下,它可以和NT一起运行在Intel x86、Alpha AXP或者MIPS等不同体系结构的微处理器环境。系统的内存和硬盘空间最小要求是16MB和96MB。在安装时,启动光盘上i386目录下的setup.exe程序,根据安装程序的提示可以很容易的完成系统安装。

  安装过程中系统主要生成了SQL Enterprise Manager、SQL Web Assistant、ISQL_W、SQL Books Online等系统工具,其中SQL Enterprise Manager是最重要的一个工具,它可以实现对SQL Server数据库系统的全面操作和维护。

  系统安装完毕后,有以下方法可以启动SQL Server服务:

使用net start mssqlserver命令启动SQL Server服务。
系统自动启动。
使用系统管理工具SQL Enterprise Manager或SQL Service Manager启动服务。
使用Windows NT控制面板里的服务选项启动SQL Server服务。


二、数据库的建立

  从SQL Enterprise Manager的数据库管理窗口选择“新建”按钮,弹出新建数据库对话框(如下页图所示)。在这个对话框中输入新建数据库的名称,选择存储数据库及其日志所使用的设备,输入它们的空间大小(以MB为单位),再根据需要选择Create for Load复选框(该复选框说明是否从一个备份库中向新建的数据库加载数据),然后选择“OK”按钮即可创建一个新的数据库。

  另外,使用SQL语句也可以创建数据库:

CREATE DATABASE MyDataBase

[ON {DEFAULT | database_device}[=size]

  [,database_device [=size]] …]

  [LOG ON database_device [=size]

[,database_device [=size]] … ]

[FOR LOAD]

  其中size是以MB为单位。

精通数据库系列之入门-技巧篇3_MySQL


三、表格的建立

  从SQL Enterprise Manager的数据库管理窗口选择DataBases->DataBaseName-> Objects->Tables,弹出新建数据表对话框(如图所示)。

  

  在这个对话框里设置属性的名称、数据类型、字段长度、是否可以为空以及缺省值等。

  设置完毕后点击“存储”的图标,完成表单的存储。

四、使用前端开发工具编程操纵数据库

  本例中前端开发工具采用Inprise Delphi4.0,通过前端程序实现对后台数据库的操作,这也是Client/Server的标准结构。

  首先在Delphi的表单上(Form)放置一些必须的控件,分别是:DataBase、Table、DataSource、DBGrid、DBNavigator。其中DataBase的属性设置为: (数据库服务器的地址)   (数据库的用户名)   (这里假设口令为123456)  

  然后将Table的DataBaseName属性设置为和DataBase控件的DataBaseName属性相同。TableName属性选择成为么操纵的数据库。

  再将DataSource控件的DataSet设为Table1(Table控件的Name)。DBGrid和DBNavigator的DataSource属性都为DataSource1(DataSource控件的Name)。

  进行以上的设置之后,就完成了一个可以操纵数据库表单的最简单的程序,程序的运行界面如下:

  

  以上实现的是基于Client/Server结构的数据库编程,在Windows NT 4.0+MS SQL Server6.5下调试通过(PIII550,256M RAM)。

  另外,我们还有基于MS-SQL Server的Browser/Server结构程序设计示例,将在以后的JSP/ASP讲座中实现。

  本讲到此结束,祝各位朋友愉快!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL's Role: Databases in Web ApplicationsMySQL's Role: Databases in Web ApplicationsApr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

MySQL: Building Your First DatabaseMySQL: Building Your First DatabaseApr 17, 2025 am 12:22 AM

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL: A Beginner-Friendly Approach to Data StorageMySQL: A Beginner-Friendly Approach to Data StorageApr 17, 2025 am 12:21 AM

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.

Is MySQL Beginner-Friendly? Assessing the Learning CurveIs MySQL Beginner-Friendly? Assessing the Learning CurveApr 17, 2025 am 12:19 AM

MySQL is suitable for beginners because: 1) easy to install and configure, 2) rich learning resources, 3) intuitive SQL syntax, 4) powerful tool support. Nevertheless, beginners need to overcome challenges such as database design, query optimization, security management, and data backup.

Is SQL a Programming Language? Clarifying the TerminologyIs SQL a Programming Language? Clarifying the TerminologyApr 17, 2025 am 12:17 AM

Yes,SQLisaprogramminglanguagespecializedfordatamanagement.1)It'sdeclarative,focusingonwhattoachieveratherthanhow.2)SQLisessentialforquerying,inserting,updating,anddeletingdatainrelationaldatabases.3)Whileuser-friendly,itrequiresoptimizationtoavoidper

Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Apr 16, 2025 am 12:20 AM

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL: Database Management System vs. Programming LanguageMySQL: Database Management System vs. Programming LanguageApr 16, 2025 am 12:19 AM

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL: Managing Data with SQL CommandsMySQL: Managing Data with SQL CommandsApr 16, 2025 am 12:19 AM

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment