国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ??? MySQL ???? ??? ???? ?? MySQL.

??? ???? ?? MySQL.

Dec 24, 2024 pm 03:41 PM

Mysql  for Mongoose developer.

??

  • ?????
  • MySQL? ??? ?????? ?? ???(RDBMS)???. ???? ???? ???? ???? ??? ? ?? ?? ??, ?? ???, ?? ??? ?????? ??????. ??? ?? ??(SQL)? ???? ???? ???? ?????.

MySQL? ?? ??:

  • ????
  • ??? ???
  • ??? ??????: MySQL? ???(????? ?)? ???? ???? ??? ?????? ??? ???? ???.
  • ???: ??? ????? ?? ??? ???? ????? ??? ? ????.
  • ACID ??: MySQL? ACID(???, ???, ??, ???) ??? ???? ?????? ????? ????? ????? ???.
    • ???? ????? ??? ? ?? ?? ??? ????? ?????. ???? ?? ?? ??? ????? ????? ?? ?? ???? ????. ?, ????? ??????. ?, "?? ??? ??"???.
    • ???? ????? ??????? ??? ??? ???? ?? ??? ??? ????? ?????. ?? ? ?? ???? ??? ?? ??, ?? ?? ? ??? ????? ??? ??? ???? ???.
    • ??? ?? ????? ??? ?????? ?? ???? ?????. ? ????? ?? ??? ????? ??? ????? ?? ????? ??? ??? ? ????.
    • ???? ?? ??? ????? ???? ??? ?? ??? ??? ???? ???? ????? ?????. ?????? ?? ?? ??? ???? ???? ?? ??? ?????? ?????.
  • ?? ??? ???: MySQL? ???? ??? ??? ?? ?? ?? ???? ??? ??????? ???? ? ????.

SQL ???

???

  1. ?????? ??
    • CREATE DATABASE ??? ? ??????? ???? ? ?????. Mongoose??? ??????? ????? ??? ??? ????. ??????? ??? ? ???? ?????.
// DB is created if it doesn't exist
mongoose.connect('mongodb://localhost/my_database');
CREATE DATABASE my_database;
  1. ?????? ??
    • USE DB_NAME? ??? ??????? ???? ? ?????. Mongoose??? ?? ???? ?? ?????.
mongoose.connect('mongodb://localhost/my_database');
USE my_database;
  1. ??? ???
    • CREATE TABLE ??? ??????? ? ???? ???? ? ?????. Mongoose?? ?? ? ???? ??? ?? ?????.
// DB is created if it doesn't exist
mongoose.connect('mongodb://localhost/my_database');
CREATE DATABASE my_database;
  1. ?? ??
    • CREATE INDEX ??? ?? ??? ????? ?? ???? ???? ???? ? ?????. MongoDB??? ?? ?????.
mongoose.connect('mongodb://localhost/my_database');
USE my_database;

????

  • SQL?? ???? ??(?? ?, ??? ??, ?? ?? ?)? ?? ? ?????. ??? ?: MongoDB?? DESCRIBE? ????? ??? ?? ????. ??? ????? ???? ???? ??? ? ????.
mongoose.model('User', UserSchema);
CREATE TABLE Users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL UNIQUE
);

?? ??

  • INSERT INTO ??? ???? ? ?? ???? ? ?????. ?????? ???/(??)? ? ??? ?????.
UserSchema.index({ email: 1 }); // Unnamed Index
UserSchema.index({ email: 1 }, { name: 'idx_email' }); // Named Index
-- Syntax: CREATE INDEX index_name ON table_name (column_name);
CREATE INDEX idx_email ON Users (email); -- Named Index
CREATE INDEX ON Users (email); -- Unnamed Index

????

  • SQL? SELECT ?? ???????? ???? ???? ? ?????. Mongoose?? ?? .find() ???? ???? ???? ???? ?? ?????.
console.log(UserSchema.paths);
// Outputs details about the schema fields and types
DESCRIBE Users;

????

  • UPDATE ?? ???? ?? ???? ???? ? ?????. ?????? find ? update ?? .update()? ?????.
// In mongoose its equivalent to .save() or .create();
const newUser = new User({ name: 'John Doe', email: 'john@example.com' });
newUser.save()
INSERT INTO Users (name, email)
VALUES ('John Doe', 'john@example.com');

??

  • DELETE ?? ???? ?? ???? ???? ? ?????. ?????? deleteOne, deleteMany ?? find ? delete? ?????.
const users = await User.find(); // Fetches all users
const { name, email } = await User.findById(1); // Fetches user with id = 1
SELECT * FROM Users; -- all users
SELECT name, email FROM Users WHERE id = 1; -- user of id 1

???

  • SQL? ALTER TABLE ?? ?? ???? ??? ???? ? ?????(? ??, ? ?? ? ? ??). Mongoose?? ??? ??? ? ??? ????? ???? ??? ?? ??? ?? ?? ??? ?? ????? ???? ????.
// update all user of name kb
const query = { name: "kb" };
User.update(query, { name: "thekbbohara" })
-- update all user of name kb
UPDATE Users
SET name = "thekbbohara", email = "thekbbohara@gmail.com"
WHERE name = "kb";

????

  • JOIN ?? ? ? ??? ??? ??? ?? ?? ???? ? ? ??? ??? ?? ???? ? ?????. MongoDB??? ??? ???????? ??? ????? ???? ????. ?? ??? ??? ?? ????? $lookup? ?? ?? ?????? ?????.
User.deleteOne({ _id: 1 })
// All users whose name is notKb will be deleted.
User.deleteMany({ name: "notKb" })

?? ??

  • INNER JOIN ???? ? ??? ???? ???? ?? ?? ???? ?????.
DELETE FROM Users WHERE id = 1;
DELETE FROM Users WHERE name = "notKb"
-- All users whose name is notKb will be deleted.

?? ??

  • LEFT JOIN ???? ?? ???(table1)? ?? ???? ???? ??? ???(table2)?? ???? ???(?? ??)? ?????.
// Update the UserSchema to add the 'age' field
const UserSchema = new mongoose.Schema({
    name: String,
    email: String,
    age: Number, // New field
});

?? ??

  • RIGHT JOIN ???? ??? ???(table2)? ?? ???? ?? ???(table1)? ???? ???(?? ??)? ?????.
-- Adds an 'age' column to the Users table
ALTER TABLE Users ADD age INT;

-- Delete 'Email' column from Users table
ALTER TABLE Users DROP COLUMN email;

-- Makes 'id' column unsigned and auto-incrementing
ALTER TABLE Users MODIFY COLUMN id INT UNSIGNED AUTO_INCREMENT;

?? ??

  • CROSS JOIN ???? ? ???(table1 ? table2)? ?? ???? ?????.
// DB is created if it doesn't exist
mongoose.connect('mongodb://localhost/my_database');

??? ??

MySQL?? ???, ??, ?? ? ??? ? ?? ?? ??? ??? ????. ??? MongoDB?? ??? ??? ??? ??? MySQL? ??? ???? ????. MongoDB? ??? ??? ?? ??? ???? BSON(Binary JSON)? ???? ???? ?????. ??? MySQL? MongoDB? ???? ??? ??? ??? ????.

??? ??? ??

MySQL MongoDB (BSON) Notes
CHAR, VARCHAR String Both store textual data. MongoDB's String is analogous to VARCHAR.
TEXT, TINYTEXT, etc. String No separate TEXT type in MongoDB; all textual data is stored as String.

?? ??? ??

MySQL MongoDB (BSON) Notes
INT, SMALLINT, etc. NumberInt Represents 32-bit integers.
BIGINT NumberLong Represents 64-bit integers.
FLOAT, DOUBLE NumberDouble Represents floating-point numbers.
DECIMAL, NUMERIC String or custom MongoDB doesn't have an exact equivalent; use String for precision.

?? ? ?? ??? ??

MySQL MongoDB (BSON) Notes
DATE Date Both store date-only values.
DATETIME, TIMESTAMP Date MongoDB stores both date and time as a Date object.
TIME String or custom MongoDB does not have a direct TIME type; store as String if needed.
YEAR String or Int Represented using String or NumberInt.

?? ??? ??

MySQL MongoDB (BSON) Notes
BOOLEAN, TINYINT(1) Boolean Both store true/false values.

???? ??? ??

MySQL MongoDB (BSON) Notes
BLOB, TINYBLOB, etc. BinData MongoDB's BinData is used for storing binary data like files.

JSON/?? ??? ??

MySQL MongoDB (BSON) Notes
JSON Object MongoDB natively stores JSON-like documents as Object.
N/A Array MongoDB has a native Array type for storing lists of values.

?? ??? ??

MySQL MongoDB (BSON) Notes
ENUM String or custom Use a String field with validation for enumerated values.
SET Array Use an Array to represent sets of values.
N/A ObjectId Unique identifier type in MongoDB, typically used as a primary key.
N/A Decimal128 Used for high-precision decimal numbers in MongoDB.

?? ?

  • ???? ? ?? ?? ???? ??? ?????.
// DB is created if it doesn't exist
mongoose.connect('mongodb://localhost/my_database');
CREATE DATABASE my_database;

?? ?

  • ?? ?? ?? ???? ?? ????? ?????.
mongoose.connect('mongodb://localhost/my_database');
USE my_database;

??? ??? ? ??

  1. NULL? ??: ?? NULL ?? ?? ? ??? ???.
mongoose.model('User', UserSchema);
CREATE TABLE Users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL UNIQUE
);
  1. ???: ?? ?? ?? ???? ?????.
UserSchema.index({ email: 1 }); // Unnamed Index
UserSchema.index({ email: 1 }, { name: 'idx_email' }); // Named Index
-- Syntax: CREATE INDEX index_name ON table_name (column_name);
CREATE INDEX idx_email ON Users (email); -- Named Index
CREATE INDEX ON Users (email); -- Unnamed Index
  1. ???: ?? ???? ??? ?? ???? ?????.
console.log(UserSchema.paths);
// Outputs details about the schema fields and types
DESCRIBE Users;
  1. ??(MySQL 8.0): ?? ?? ??? ??? ????? ?????.
// In mongoose its equivalent to .save() or .create();
const newUser = new User({ name: 'John Doe', email: 'john@example.com' });
newUser.save()
INSERT INTO Users (name, email)
VALUES ('John Doe', 'john@example.com');
  1. ?? ??: ?? ?? ?? ???? ?? ?? ?? ???? ?????.
const users = await User.find(); // Fetches all users
const { name, email } = await User.findById(1); // Fetches user with id = 1
SELECT * FROM Users; -- all users
SELECT name, email FROM Users WHERE id = 1; -- user of id 1

?? ????. ??? ????. ???? ???? ?????. thekbbohara

? ??? ???? ? ????.

?, ??? Mysql? ??? ??????
Docker ??? ?????.

// update all user of name kb
const query = { name: "kb" };
User.update(query, { name: "thekbbohara" })
-- update all user of name kb
UPDATE Users
SET name = "thekbbohara", email = "thekbbohara@gmail.com"
WHERE name = "kb";

? ??? ??? ???? ?? MySQL.? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

?? ????
1792
16
Cakephp ????
1733
56
??? ????
1584
29
PHP ????
1455
31
???
MySQL ??? ?? ??? ?? ?? ?? MySQL ??? ?? ??? ?? ?? ?? Jul 04, 2025 am 01:44 AM

TOSECIBERYNECTTOEREMOTEMYSQLSERVER, USESSHTUNNENG, CONFIGUREMYSQLFORREMOTEACCESS, SETFIREWALLRULES ? CONSIDERSSLENCRYPTION .First, SpectionANSSHTUNNELWITHSSH-L3307 : LocalHost : 3306user@remote-Server-NandConnectViamySQL-H127.0.1-P3307.second, editmys

MySQL ? ????? ??? ??? ???? ?? MySQL ? ????? ??? ??? ???? ?? Jul 01, 2025 am 01:39 AM

MySQL? ? ????? ??? ??? ????? ?? ?? ??? ?? ???????. 1. Windows ??? : MySQL ?? ?????? ? ??? ????? (?? ??? ????? C : \ programfiles \ mysql \ mysqlserverx.x \ bin), "? ???"→ "??"→ "Advanced System ??"→ "?? ??", "??? ??", MySQlb in wors in mysqlb in wors in mysqlb in world in that the the the the the seel worl ?? ????? ?? ???? MySQL? ??????-Version Versification; 2.Macos ? Linux ??? : Bash ??? ?? ~/.bashrc ?? ~/.bash_

MySQL? ???? ?? ??? ???? ?? ???? ????? MySQL? ???? ?? ??? ???? ?? ???? ????? Jun 23, 2025 pm 03:05 PM

MySQL? ?? ???? ?? ??? ??? ? A??, ?? MVCC ? GAP ?? ??? ?? ??? ?? ? ?? ???? ??? ???? ???? ?? ?? ??? ????. ?? ?? ??? ??? ?? (??)? ????? ??? ??? ????? ?? ?? ??? ????? 1. ??? ??? (read committed)? ?? ? ???? ?? ? ??? ?? ? ??? ?? ? ?? ?? ?? ?? ? ? ????. ???, ??? ??? ????? ??? ??;

MySQL Workbench? ?? ??? ??? ?????? MySQL Workbench? ?? ??? ??? ?????? Jun 26, 2025 am 05:23 AM

mysqlworkbench? ??? ?? ??? ?? ??? ?????. ?? ??? ?? ??? ?? ????. 1. Windows ???? %appdata %\ mysql \ workbench \ connections.xml? ????. 2. MacOS ???? ~/Library/ApplicationSupport/MySQL/Workbench/Connections.xml? ????. 3. ????? Linux ???? ~/.mysql/workbench/connections.xml ?? ~/.local/share/data/mysql/wor? ????.

?? ?? ??? ?? ?? MySQL ?? ?? ?? ?? ?? ?? ??? ?? ?? MySQL ?? ?? ?? ?? Jul 04, 2025 am 02:46 AM

MySQL ??? ?? ??? ?? ?? ??? ?? ??? ??????. 1. ?? ?? ?? ?? ???? Slow_Query_Log ? Long_Query_Time; 2. ???? ??? ?? ??? ???? ? ????? query_time, lock_time, rows_examined? ?? ?? ??? ???? ????. 3. ??? ????? ???? ?? mysqldumpslow ?? pt-query idigest ??? ??????. 4. ??? ???? ??? ??, ??*???*, ??? ?? ?? ?? ?????. ?? ??, user_id? ???? ???? ?? ? ?? ?? ?? ??? ?? ???? ???? ? ????.

MySQL?? mysqldump? ???? ?? ??? ????? MySQL?? mysqldump? ???? ?? ??? ????? Jul 06, 2025 am 02:55 AM

MySQLDump? MySQL ??????? ??? ??? ???? ???? ?????. ??????? ???? ?? ?? ? ?? ?? ???? SQL ??? ?????. 1. ?? ??? ????? ??? ?????? ??? ???? ??? SQL ???? ?????. 2. ??? ?????? ?? ??? ??? ???? TB ?? ???? ?? ???? ???? ????. 3. ???? ???-single transaction,-databases,-all-databases,-routines ?; 4. MySQL ??? ???? ?? ?? ?? ?? ?? ? ??? ?? ??? ???? ? ????. 5. ??? ????? ????? ?? ? ?? ??? ???? ?? ????.

MySQL ? ? ???? NULL ?? ????? MySQL ? ? ???? NULL ?? ????? Jul 05, 2025 am 02:46 AM

MySQL?? NULL ?? ?? ? ? 1. ???? ?? ? ? ? ??? NotNull? ???? ?? ??? NULL? ?????. 2. iSnull ?? ISNOTNULL = ??! =; 3. Ifnull ?? Coalesce ??? ????? ???? ???? ? ??? ? ????. 4. ?? ?? ????? NULL ?? ?? ??? ?? ???? ??? ?? ? ORM ??? ?? ?? ?????? ??????. NULL? ???? ?? ?? ???? ??? ???? ?? ?? ?? ????. ??? ???? ??, ?? ? ???? ?? ? ??? ?? ??? ??? ?? ???????. ??? ??? ???? ??? ?? ?? ??? ????? ?? ? ????.

MySQL ??? ?? ???? ??? MySQL ??? ?? ???? ??? Jul 03, 2025 am 02:32 AM

MySQL? ?? ????? ?????? ?? ??? ?????. 1. MySQL ?? ??, sudosystemctlstopmysql ?? sudosystemctlstopmysqld? ??????. 2. -skip-grant-tables ???? mysql? ???? sudomysqld-skip-grant-tables &; 3. MySQL? ????? ?? SQL ??? ???? FlushPrivileges; Alteruser'Root '@'localHost'IndifiedBy'Your_new? ?? ??? ?? ????? ??????.

See all articles