Home Database Mysql Tutorial MySQL程序设计介绍[图]_MySQL

MySQL程序设计介绍[图]_MySQL

Jun 01, 2016 pm 01:52 PM
context user program

  MySQL有一组实用程序。例如,mysqldump 导出表的上下文和结构定义,mysqlimport将数据文件加载到表中, mysqladmin 实现管理w操作,mysql可以使用户与服务器交互来执行任意的查询。每个标准的MySQL实用程序都倾向于小巧,重点放在程序可完成特定的、有限的功能。即使mysql也是如此,从感觉上说,mysql比其他实用程序更灵活,因此可以用它来执行任何数量的各种查询,即它就是为允许向服务器直接发布SQL 查询,并可查看查询结果这一单一目的而设计的。

  MySQL客户机这种有限的特性并不是缺点,而是特意设计的。程序是具有通用目的的实用程序;它们并不试图预料您所想做的所有可能的需要。MySQL的开发者们不赞成编写大型的、臃肿的程序来试图做可能想去做的每件事情(而且这样做的结果将使程序中包括大量的您根本不关心的事情的代码)。然而,有时有些应用确实有常规客户机的能力所无法处理的需求。为了处理这些情况,MySQL提供一个客户机编程库。这允许您编写自己的程序,满足您的应用程序可能具有的任何特定需求。通过允许您对MySQL服务器的访问,客户机的开放程度只受您自己想象力的限制了。

  编写自己的程序可以获取如何特殊的能力呢?让我们比较一下mysql客户机和其没有附加代码的接口对MySQL服务器的访问:

  可以定制输入处理

  用mysql可以输入原始的SQL 语句。用自己的程序,可以为用户提供使用起来更直观、更容易的输入方法。用程序可使用户不必知道SQL―甚至不必知道在完成的任务中数据库承担的角色。

  输入信息的采集可能是像命令行风格的提示和值读取这样基本的方式,或者可能是使用屏幕管理程序包(如curses 或S - L a n g)、使用Tcl/Tk 的X 窗口或Web 浏览器格式实现的基于屏幕输入那样复杂的方式。

  对大多数人来说,通过填写一定的格式来指定搜索参数的形式比通过发布SELECT语句更容易。例如,一位房地产经纪人,要寻找一定价格范围、风格或位置的房屋,只要将查寻参数输入到表格中,就可以最小的代价得到符合条件的内容。输入新记录或更新已有记录也类似地考虑这种应用。在数据输入部门的键盘操作员应该不需要知道像INSERT、REPLACE 或UPDATE 这样的SQL 语法。

  在最终用户和MySQL服务器之间提出输入采集层的另一个原因是可以校验用户提供的输入。例如,可以检查数据,确认它们是符合MySQL要求的格式,或可以要求填写特定的区域。

  可以定制输出

  mysql的输出基本上是无格式的;可以选择以制表符为分隔符或以表格形式输出。如果想要使输出结果看起来比较好,则必须自己对它进行格式化。这些需求可能像打印“Missing”而不是NULL 这样简单,也可能更复杂。考虑下面的报告:

MySQL程序设计介绍[图]_MySQL

  这个报告包括几个特定的元素:

  1、定制标题。

  2、在State 列中重复值的抑制以便只在更改时才将这些值打印出来。

  3、小计和总计的计算。

  4、数字格式,如9 4 3 8 4 . 2 4,打印为美元数量为$ 9 4 , 3 8 4 . 2 4。对于一些任务,甚至可能不需要任何输出。您可能正在对计算向后插入到另一个数据库表中的结果进行简单地检索信息。除了用户运行这个查询以外,甚至可能还想将这个结果输出到其他地方。例如,如果正在提取姓名和电子邮件地址以自动地填入为批量电子邮件生成信件格式的过程中,则程序产生输出。但是该输出由邮件接受者的信息组成,而没有运行程序人员的信息。可以在SQL自身施加的约束条件的环境下工作。SQL 不是一种带有条件选择、循环和子例程的流程控制结构的过程语言。SQL 脚本包括一组从开始到结束一次一个的可执行语句,具有最低限度的错误检查。

Statement of this Website
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

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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use Xiaohongshu account to find users? Can I find my mobile phone number? How to use Xiaohongshu account to find users? Can I find my mobile phone number? Mar 22, 2024 am 08:40 AM

With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

How to make Google Maps the default map in iPhone How to make Google Maps the default map in iPhone Apr 17, 2024 pm 07:34 PM

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

What is sudo and why is it important? What is sudo and why is it important? Feb 21, 2024 pm 07:01 PM

sudo (superuser execution) is a key command in Linux and Unix systems that allows ordinary users to run specific commands with root privileges. The function of sudo is mainly reflected in the following aspects: Providing permission control: sudo achieves strict control over system resources and sensitive operations by authorizing users to temporarily obtain superuser permissions. Ordinary users can only obtain temporary privileges through sudo when needed, and do not need to log in as superuser all the time. Improved security: By using sudo, you can avoid using the root account during routine operations. Using the root account for all operations may lead to unexpected system damage, as any mistaken or careless operation will have full permissions. and

Clock app missing in iPhone: How to fix it Clock app missing in iPhone: How to fix it May 03, 2024 pm 09:19 PM

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

How to write a simple countdown program in C++? How to write a simple countdown program in C++? Nov 03, 2023 pm 01:39 PM

C++ is a widely used programming language that is very convenient and practical in writing countdown programs. Countdown program is a common application that can provide us with very precise time calculation and countdown functions. This article will introduce how to use C++ to write a simple countdown program. The key to implementing a countdown program is to use a timer to calculate the passage of time. In C++, we can use the functions in the time.h header file to implement the timer function. The following is the code for a simple countdown program

Windows 11 KB5031455 fails to install, causing other issues for some users Windows 11 KB5031455 fails to install, causing other issues for some users Nov 01, 2023 am 08:17 AM

Microsoft began rolling out KB2 to the public as an optional update for Windows 503145511H22 or later. This is the first update to enable Windows 11 Moment 4 features by default, including Windows Copilot in supported areas, preview support for items in the Start menu, ungrouping of the taskbar, and more. Additionally, it fixes several Windows 11 bugs, including potential performance issues that caused memory leaks. But ironically, the optional update for September 2023 will be a disaster for users trying to install the update, or even for those who have already installed it. Many users will not install this Wi

Tutorial: How to delete a normal user account in Ubuntu system? Tutorial: How to delete a normal user account in Ubuntu system? Jan 02, 2024 pm 12:34 PM

Many users have been added to the Ubuntu system. I want to delete the users that are no longer in use. How to delete them? Let’s take a look at the detailed tutorial below. 1. Open the terminal command line and use the userdel command to delete the specified user. Be sure to add the sudo permission command, as shown in the figure below. 2. When deleting, be sure to be in the administrator directory. Ordinary users do not have this permission. , as shown in the figure below 3. After the delete command is executed, how to judge whether it has been truly deleted? Next we use the cat command to open the passwd file, as shown in the figure below 4. We see that the deleted user information is no longer in the passwd file, which proves that the user has been deleted, as shown in the figure below 5. Then we enter the home file

See all articles