Skip to content

Commit cca144d

Browse files
committed
added misc
1 parent 1060209 commit cca144d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,39 @@ create table emp_dup like employee;
311311
```sql
312312
create table emp_dup select * from employee;
313313
```
314+
315+
## Programming
316+
317+
#### Declare variables
318+
```sql
319+
set @num = 10;
320+
set @name = 'Anurag';
321+
```
322+
323+
#### Print them
324+
```sql
325+
select @name;
326+
```
327+
328+
#### For loop
329+
```sql
330+
set @n = 21;
331+
select repeat("* ", @n := @n - 1) from information_schema.tables where @n > 0;
332+
```
333+
334+
## Miscellaneous
335+
336+
#### Repeated concatenation
337+
```sql
338+
select repeat("* ", 20);
339+
```
340+
341+
#### Random float
342+
```sql
343+
select rand();
344+
```
345+
346+
#### Typecast to int
347+
```sql
348+
select cast(23.01245 as signed);
349+
```

0 commit comments

Comments
 (0)