Home Database Mysql Tutorial mysql学习记录(十)--存储过程_MySQL

mysql学习记录(十)--存储过程_MySQL

May 30, 2016 pm 05:10 PM
process

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

mysql> use test1;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database change

 

mysql> select * from emp;

+------------+----------+------+--------+

| ename      | hiredate | sal  | deptno |

+------------+----------+------+--------+

| aaaaa      | NULL     | NULL |      1 |

| cccccccccc | NULL     | NULL |      2 |

| ddddddddd  | NULL     | NULL |      3 |

| ffffff     | NULL     | NULL |      4 |

| ggg        | NULL     | NULL |      5 |

| a1         | NULL     | NULL |      5 |

+------------+----------+------+--------+

6 rows in set (0.00 sec)

 

mysql> show create table emp \G;

*************************** 1. row ***************************

       Table: emp

Create Table: CREATE TABLE `emp` (

  `ename` varchar(10) DEFAULT NULL,

  `hiredate` date DEFAULT NULL,

  `sal` decimal(10,2) DEFAULT NULL,

  `deptno` int(2) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8

1 row in set (0.01 sec)

 

ERROR:

No query specified

 

mysql> DELIMITER && 

mysql> CREATE  PROCEDURE  num_from_employee (IN input_deptno int, OUT count_num INT ) 

    -> READS SQL DATA 

    ->     BEGIN 

    ->     SELECT  COUNT(*) FROM emp WHERE  deptno=input_deptno ; 

    -> END  &&

Query OK, 0 rows affected (0.01 sec)

 

mysql> delimiter ;

 

mysql> call num_from_employee(5,@a);

+----------+

| COUNT(*) |

+----------+

|        2 |

+----------+

1 row in set (0.02 sec)

 

Query OK, 0 rows affected (0.02 sec)

 

mysql> call num_from_employee(1,@a);

+----------+

| COUNT(*) |

+----------+

|        1 |

+----------+

1 row in set (0.01 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

mysql> create table inventory(

    -> film_id int(11),

    -> store_id int(11),

    -> inventory_in_stock varchar(50)

    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Query OK, 0 rows affected (0.02 sec)

 

mysql> insert into inventory(film_id,store_id,inventory_in_stock) values  (1,2,'aaaaaaaa'), (3,4,'bbbb'), (5,6,'cccccccccc'), (7,8,'dddddd'), (9,10,'fff');

Query OK, 5 rows affected (0.00 sec)

Records: 5  Duplicates: 0  Warnings: 0

  

mysql> select * from inventory;

+---------+----------+--------------------+

| film_id | store_id | inventory_in_stock |

+---------+----------+--------------------+

|       1 |        2 | aaaaaaaa           |

|       3 |        4 | bbbb               |

|       5 |        6 | cccccccccc         |

|       7 |        8 | dddddd             |

|       9 |       10 | fff                |

+---------+----------+--------------------+

5 rows in set (0.00 sec)

 

mysql> delimiter $$

mysql> create procedure film_in_stock(in p_film_id int,in p_store_id int,out p_film_count int)

    -> reads sql data

    -> begin

    ->   select film_id

    ->   from inventory

    ->   where film_id = p_film_id

    ->   and store_id = p_store_id;

    ->   select found_rows() into p_film_count;

    -> end $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> delimiter ;

mysql> call film_in_stock(5,6,@a);

+---------+

| film_id |

+---------+

|       5 |

+---------+

1 row in set (0.01 sec)

 

Query OK, 1 row affected (0.01 sec)

 

mysql> show create procedure film_in_stock \G;

*************************** 1. row ***************************

           Procedure: film_in_stock

            sql_mode:

    Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `film_in_stock`(in p_film_id int,in p_store_id int,out p_film_count int)

    READS SQL DATA

begin

  select film_id

  from inventory

  where film_id = p_film_id

  and store_id = p_store_id;

  select found_rows() into p_film_count;

end

character_set_client: utf8

collation_connection: utf8_general_ci

  Database Collation: utf8_general_ci

1 row in set (0.01 sec)

 

ERROR:

No query specified

 

mysql> create table actor(

    -> actor_id int(11)  NOT NULL AUTO_INCREMENT , 

    -> first_name varchar(30),

    -> last_name varchar(30),

    ->   PRIMARY KEY (actor_id) 

    -> ) engine = innodb charset = utf8;

Query OK, 0 rows affected (0.02 sec)

 

 

mysql> delimiter $$

mysql> create procedure actor_insert()

    -> begin

    -> set @x = 1;

    -> insert into actor(actor_id,first_name,last_name) values (201,'Test',201);

    -> set @x = 2;

    -> insert into actor(actor_id,first_name,last_name) values(1,'Test','1');

    -> set @x = 3;

    -> end $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> call actor_insert();

Query OK, 0 rows affected (0.02 sec)

 

mysql> call actor_insert();

ERROR 1062 (23000): Duplicate entry '201' for key 'PRIMARY'

mysql> select @x;

+------+

| @x   |

+------+

|    1 |

+------+

1 row in set (0.00 sec)

 

mysql> delimiter $$

mysql> create procedure actor_insert_new()

    -> begin

    -> DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;

    -> set @x = 1;

    -> insert into actor(actor_id,first_name,last_name) values (201,'Test',201);

    -> set @x = 2;

    -> insert into actor(actor_id,first_name,last_name) values(1,'Test','1');

    -> set @x = 3;

    -> end $$

Query OK, 0 rows affected (0.02 sec)

 

mysql> delimiter ;

 

mysql> call actor_insert_new();

Query OK, 0 rows affected, 1 warning (0.01 sec)

 

mysql> call actor_insert_new();

Query OK, 0 rows affected, 1 warning (0.00 sec)

 

mysql> select @x,@x2;

+------+------+

| @x   | @x2  |

+------+------+

|    3 |    1 |

+------+------+

1 row in set (0.00 sec)

 

mysql> show create table payment \G;

*************************** 1. row ***************************

       Table: payment

Create Table: CREATE TABLE `payment` (

  `staff_id` int(11) DEFAULT NULL,

  `amount` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8

1 row in set (0.01 sec)

 

ERROR:

No query specified

 

mysql> select * from payment;

+----------+--------+

| staff_id | amount |

+----------+--------+

|        1 |  10000 |

|        2 |  20000 |

|        3 |  30000 |

|        4 | 400000 |

|        5 | 500000 |

+----------+--------+

5 rows in set (0.01 sec)

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    -> declare tmp_name varchar(30) default "";

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         select i_staff_id,d_amount;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> delimiter ;

 

mysql> call  payment_stat();

+------------+----------+

| i_staff_id | d_amount |

+------------+----------+

|          1 |    10000 |

+------------+----------+

1 row in set (0.01 sec)

 

+------------+----------+

| i_staff_id | d_amount |

+------------+----------+

|          2 |    20000 |

+------------+----------+

1 row in set (0.01 sec)

 

+------+------+

| @x1  | @x2  |

+------+------+

|    0 |    0 |

+------+------+

1 row in set (0.01 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

mysql> drop  procedure payment_stat;

Query OK, 0 rows affected (0.00 sec)

 

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    -> declare tmp_name varchar(30) default "";

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         set @x1 = @x1+ i_staff_id;

    ->     else

    ->         set @x2 = @x2+ d_amount;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> call  payment_stat();

    -> $$

+------+-------+

| @x1  | @x2   |

+------+-------+

|    3 | 30000 |

+------+-------+

1 row in set (0.01 sec)

 

Query OK, 0 rows affected (0.01 sec)

 

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    ->

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         set @x1 = @x1+ i_staff_id + 1;

    ->     else

    ->         set @x2 = @x2+ d_amount ;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.00 sec)

 

mysql> delimiter ;

mysql> call  payment_stat();

+------+-------+

| @x1  | @x2   |

+------+-------+

|    3 | 30000 |

+------+-------+

1 row in set (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

mysql> drop  procedure payment_stat;

Query OK, 0 rows affected (0.00 sec)

 

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    ->

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         set @x1 = @x1+ i_staff_id;

    ->     else

    ->         set @x2 = @x2+ d_amount;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.00 sec)

 

 

mysql> delimiter ;

mysql> call  payment_stat();

+------+-------+

| @x1  | @x2   |

+------+-------+

|    3 | 30000 |

+------+-------+

1 row in set (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    ->

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         set @x1 = @x1+ i_staff_id + 1;

    ->     else

    ->         set @x2 = @x2+ d_amount;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> delimiter ;

mysql> call  payment_stat();

+------+-------+

| @x1  | @x2   |

+------+-------+

|    5 | 30000 |

+------+-------+

1 row in set (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

mysql> drop  procedure payment_stat;

Query OK, 0 rows affected (0.02 sec)

 

 

mysql> delimiter $$

mysql> create procedure payment_stat()

    -> begin

    -> DECLARE i_staff_id int;

    -> DECLARE d_amount int;

    ->

    -> DECLARE cur_payment cursor for select staff_id,amount from payment;

    -> DECLARE EXIT HANDLER FOR NOT FOUND CLOSE cur_payment;

    ->

    -> set @x1 = 0 ;

    -> set @x2 = 0 ;

    ->

    -> open cur_payment;

    -> fetch cur_payment into i_staff_id,d_amount;

    -> while(i_staff_id <=3  )

    -> do

    ->     if i_staff_id < 3 then

    ->         set @x1 = @x1+ i_staff_id + 6;

    ->     else

    ->         set @x2 = @x2+ d_amount + 5;

    ->     end if;

    -> fetch cur_payment into  i_staff_id,d_amount;

    -> end while;

    -> close cur_payment;

    ->

    -> select @x1,@x2;

    -> end;

    -> $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> delimiter ;

 

mysql> call  payment_stat();

    

+------+-------+

| @x1  | @x2   |

+------+-------+

|   15 | 30005 |

+------+-------+

1 row in set (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

mysql> DELIMITER $$

mysql>

mysql> CREATE PROCEDURE addNum()

    -> BEGIN

    -> DECLARE x  INT;

    -> SET x = 0;

    -> for_loop :  LOOP

    ->   SET  x = x + 1;

    ->   IF  x > 30 THEN

    ->    LEAVE  for_loop;

    ->   END IF;

    ->   IF mod(x,2) = 0 then

    ->     select "num:",x;

    ->   ITERATE for_loop;

    ->   END IF;

    -> END LOOP;

    -> select "count:",x;

    -> END $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> call addNum();

    -> $$

+------+------+

| num: | x    |

+------+------+

| num: |    2 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |    4 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |    6 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |    8 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   10 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   12 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   14 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   16 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   18 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   20 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   22 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   24 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   26 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   28 |

+------+------+

1 row in set (0.00 sec)

 

+------+------+

| num: | x    |

+------+------+

| num: |   30 |

+------+------+

1 row in set (0.00 sec)

 

+--------+------+

| count: | x    |

+--------+------+

| count: |   31 |

+--------+------+

1 row in set (0.00 sec)

 

Query OK, 0 rows affected (0.00 sec)

 

mysql> delimiter $$

mysql> create procedure repeatPractise()

    ->      begin

    ->      set @v = 0 ;

    ->      REPEAT

    ->         set @v =  @v+ 1;

    ->      UNTIL @v >=5 

    ->      END REPEAT;

    ->  END

    ->  $$

Query OK, 0 rows affected (0.01 sec)

 

mysql> call repeatPractise();

    -> $$

Query OK, 0 rows affected (0.00 sec)

 

mysql> select @v;

    -> $$

+------+

| @v   |

+------+

|    5 |

+------+

1 row in set (0.00 sec)

Copy after login

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 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 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 do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

See all articles