实验2SQL1-DDL
【实验目的】 1. 掌握数据库的定义方法、删除方法 2. 掌握数据表的定义、修改与删除方法 3. 熟悉数据库、数据表的强制与限制删除的区别 4. 了解索引的定义与删除。 【实验过程】 1. 实验条件:MySQL已经安装完成,能够正确使用 2. 定义数据库SC create datab
【实验目的】
1. 掌握数据库的定义方法、删除方法
2. 掌握数据表的定义、修改与删除方法
3. 熟悉数据库、数据表的强制与限制删除的区别
4. 了解索引的定义与删除。
【实验过程】
1. 实验条件:MySQL已经安装完成,能够正确使用
2. 定义数据库SC
create database SC
检验是否成功:查看有哪些数据库,show databases;
3. 使用数据库SC
再使用SC
use sc;
检验:查看当前数据库有哪些数据表,show tables;
4. 创建数据表Student
create table student
(
sno char(10) primary key,
sname char(20) unique,
ssex char(2),
sage int,
sdept char(10)
);
成功后,再查看有哪些数据表
5. 查看student数据表结构
DESC student;
6. 添加新列入学日期ent_date
7. 添加索引按入学日期的索引
8. 删除数据表(先尝试限制删除,再尝试强制删除),检查有什么不同。
9. 新建课程表Course
10. 建立按cpno的聚簇索引index_c_cpno
11. 建立按cno的唯一索引 index_cno
12. 删除数据库SC(先尝试限制删除,再尝试强制删除),检查有什么不同。
【作业】
1.在数据库SC内建立数据表student、course、sc(选修表)和teacher(教师表)
2.注意表间的参照引用关系。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

With the popularity of Douyin, more and more individuals and companies have begun to pay attention to the Douyin account matrix. The Douyin account matrix refers to the creation of multiple related accounts to form an organic whole to achieve the purpose of expanding brand influence and improving user stickiness. So, what are the benefits of Douyin account matrix? What is the purpose of making a Douyin account matrix? This article explores these issues in detail. 1. What are the benefits of Douyin account matrix? Increase brand exposure: By creating multiple Douyin accounts, brand information can reach more potential users, helping to increase the brand's visibility and reputation. Improve content exposure: Using Douyin’s recommendation algorithm to publish content through multiple accounts can increase the exposure opportunities of brands and products and improve their visibility on the platform. 3. Achieve precision

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

What are full-width characters? In computer encoding systems, double-width characters are a character encoding method that takes up two standard character positions. Correspondingly, the character encoding method that occupies a standard character position is called a half-width character. Full-width characters are usually used for input, display and printing of Chinese, Japanese, Korean and other Asian characters. In Chinese input methods and text editing, the usage scenarios of full-width characters and half-width characters are different. Use of full-width characters Chinese input method: In the Chinese input method, full-width characters are usually used to input Chinese characters, such as Chinese characters, symbols, etc.
