* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 *                                                                                                               * 
 
 *                 D E S :   D a t a l o g   E d u c a t i o n a l   S y s t e m   v . 3 . 0                     * 
 
 *                                                                                                               * 
 
 *                                                                                                               * 
 
 *   T y p e   " / h e l p "   f o r   h e l p   a b o u t   c o m m a n d s                                     * 
 
 *   T y p e   " d e s . "   t o   c o n t i n u e   i f   y o u   g e t   o u t   o f   D E S                   * 
 
 *       f r o m   a   P r o l o g   i n t e r p r e t e r                                                       * 
 
 *                                                                                                               * 
 
 *                                         F e r n a n d o   S a e n z - P e r e z   ( c )   2 0 0 4 - 2 0 1 1   * 
 
 *                                                                                   G P D   D I S I A   U C M   * 
 
 *                           P l e a s e   s e n d   c o m m e n t s ,   q u e s t i o n s ,   e t c .   t o :   * 
 
 *                                                                           f e r n a n @ s i p . u c m . e s   * 
 
 *                                                                                           W e b   s i t e :   * 
 
 *                                                       h t t p : / / d e s . s o u r c e f o r g e . n e t /   * 
 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 D E S >   / p r o c e s s   e x a m p l e s / S Q L D e b u g g e r / a w a r d s 2 
 
 
 
 I n f o :   P r o c e s s i n g   f i l e   ' e x a m p l e s / S Q L D e b u g g e r / a w a r d s 2 . s q l '   . . . 
 
 
 
 D E S >   - -   S Q L   D e b u g g e r 
 
 
 
 
 
 D E S >   - -   N o v e m b e r   2 0 1 1 
 
 
 
 
 
 D E S >   - -   E x a m p l e   2   A w a r d s 
 
 
 
 
 
 D E S >   - -   W r o n g   t u p l e   ' A n n a ' 
 
 
 
 
 
 D E S >   - -   R e f e r   t o   e x a m p l e 2 U s e r T r a c e . t x t   f o r   a   u s e r   t r a c e   a n d   e x a m p l e 2 D e v e l o p m e n t T r a c e . t x t   f o r   a   d e v e l o p m e n t   t r a c e 
 
 
 
 
 
 D E S >   - - 
 
 
 
 
 
 D E S >   - -   D e c l a r a t i v e   D e b u g g i n g   o f   W r o n g   a n d   M i s s i n g   A n s w e r s   f o r   S Q L   V i e w s 
 
 
 
 
 
 D E S >   - -   F L O P S   2 0 1 2 
 
 
 
 
 
 D E S >   
 
 
 
 
 
 D E S >   / a b o l i s h 
 
 
 
 
 
 D E S >   / m u l t i l i n e   o n 
 
 
 
 
 
 D E S >   / d e v e l o p m e n t   o f f 
 
 
 
 I n f o :   D e v e l o p m e n t   l i s t i n g s   a r e   a l r e a d y   d i s a b l e d . 
 
 
 
 D E S >   - -   T u r n   d e v e l o p m e n t   o n   t o   i n s p e c t   m o r e   i n f o 
 
 
 
 
 
 D E S >   - -   / d e v e l o p m e n t   o n 
 
 
 
 
 
 D E S >   / *   T a b l e s   * / 
 
 
 
 
 
 D E S >   D R O P   T A B L E   I F   E X I S T S   g r a n t s ,   p a y m e n t ,   r e g i s t r a t i o n ,   c o u r s e s ; 
 
 
 
 
 
 D E S >   C R E A T E   T A B L E   g r a n t s   ( 
 
       s t u d e n t   v a r c h a r ( 4 5 )   D E F A U L T   N U L L , 
 
       a m o u n t   i n t e g e r   d e f a u l t   0 
 
 ) ; 
 
 
 
 
 
 D E S >   C R E A T E   T A B L E   c o u r s e s   ( 
 
     i d c o u r s e s   v a r c h a r ( 1 1 )   N O T   N U L L , 
 
     s t y l e   v a r c h a r ( 4 5 )   D E F A U L T   N U L L , 
 
     l e v e l   i n t ( 1 1 )   D E F A U L T   N U L L , 
 
     t e a c h e r   v a r c h a r ( 1 0 )   D E F A U L T   N U L L , 
 
     P R I M A R Y   K E Y   ( ` i d c o u r s e s ` ) 
 
 ) ; 
 
 
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 1 ' ,   ' s a l s a ' ,         1 ,   ' t e a c h 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 2 ' ,   ' s a l s a ' ,         2 ,   ' t e a c h 2 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 3 ' ,   ' M e r e n g u e ' ,   3 ,   ' t e a c h 3 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 4 ' ,   ' s a l s a ' ,         3 ,   ' t e a c h 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 5 ' ,   ' s a l s a ' ,         3 ,   ' t e a c h 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 6 ' ,   ' s a l s a ' ,         3 ,   ' t e a c h 3 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` c o u r s e s `   ( ` i d c o u r s e s ` ,   ` s t y l e ` ,   ` l e v e l ` ,   ` t e a c h e r ` )   V A L U E S   ( ' c 7 ' ,   ' s a l s a ' ,         0 ,   ' t e a c h 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   C R E A T E   T A B L E   r e g i s t r a t i o n   ( 
 
     i d r e g i s t r a t i o n   i n t ( 1 1 )   N O T   N U L L , 
 
     s t u d e n t   v a r c h a r ( 4 5 )   D E F A U L T   N U L L , 
 
     c o u r s e   v a r c h a r ( 1 1 )   D E F A U L T   N U L L , 
 
     P R I M A R Y   K E Y   ( ` i d r e g i s t r a t i o n ` ) 
 
 ) ; 
 
 
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 1 ,   ' J u a n ' ,   ' c 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 2 ,   ' J u a n ' ,   ' c 2 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 3 ,   ' J u a n ' ,   ' c 6 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 4 ,   ' J u a n ' ,   ' c 5 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 5 ,   ' P e d r o ' ,   ' c 2 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 6 ,   ' A n a ' ,   ' c 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 7 ,   ' A n a ' ,   ' c 2 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 8 ,   ' A n a ' ,   ' c 5 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 9 ,   ' M i c a ' ,   ' c 6 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 1 0 ,   ' J u a n ' ,   ' c 7 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 1 1 ,   ' M i c a ' ,   ' c 2 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   I N S E R T   I N T O   ` r e g i s t r a t i o n `   ( ` i d r e g i s t r a t i o n ` ,   ` s t u d e n t ` ,   ` c o u r s e ` )   V A L U E S   ( 1 2 ,   ' M i c a ' ,   ' c 1 ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   C R E A T E   T A B L E   p a y m e n t   ( 
 
     ` i d `   i n t ( 1 1 )   N O T   N U L L , 
 
     ` s t u d e n t `   v a r c h a r ( 4 5 )   D E F A U L T   N U L L , 
 
     ` s t a t e `   v a r c h a r ( 1 1 )   D E F A U L T   N U L L , 
 
     P R I M A R Y   K E Y   ( ` i d ` ) 
 
 ) ; 
 
 
 
 
 
 D E S >   I N S E R T   I N T O   ` p a y m e n t `   ( ` i d ` ,   ` s t u d e n t ` ,   ` s t a t e ` )   V A L U E S   ( 1 ,   ' M i g u e l ' ,   ' u n p a i d ' ) ; 
 
 
 
 I n f o :   1   t u p l e   i n s e r t e d .                                           
 
 
 
 D E S >   / *   V i e w s   * / 
 
 
 
 
 
 D E S >   / *   S a l s a   c o u r s e s   * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   s a l s a C o u r s e s ( i d ,   l e v e l ,   t e a c h e r )   a s 
 
     s e l e c t   c . i d c o u r s e s ,   c . l e v e l ,   c . t e a c h e r 
 
     f r o m   c o u r s e s   c 
 
     w h e r e   c . s t y l e   =   ' s a l s a ' ;     
 
 
 
 
 
 D E S >   / *   S t u d e n t s   o f   s a l s a   c o u r s e s   * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   s a l s a S t u d e n t s ( s t u d e n t ,   l e v e l ,   t e a c h e r )   a s 
 
       s e l e c t   R . s t u d e n t ,   C . l e v e l ,   C . t e a c h e r 
 
       f r o m   s a l s a C o u r s e s   C ,   r e g i s t r a t i o n   R 
 
       w h e r e   C . i d   =   R . c o u r s e ; 
 
 
 
 
 
 D E S >   / *   S t u d e n t s   o f   i n t e n s i v e   c o u r s e   ( l e v e l   =   0 )   * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   i n t e n s i v e S t u d e n t s ( s t u d e n t )   a s 
 
       s e l e c t   S . s t u d e n t 
 
       f r o m   s a l s a S t u d e n t s   S 
 
       w h e r e   S . l e v e l   =   0 ; 
 
 
 
 
 
 D E S >   / *   S t u d e n t s   o f   f i r s t   t h r e e   c o u r s e s   w i t h   d i f f e r e n t   t e a c h e r s   * / 
 
 
 
 
 
 D E S >   / *   T h i s   i s   t h e   i l l - d e f i n e d   v i e w   * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   b a s i c L e v e l S t u d e n t s ( s t u d e n t )   a s 
 
 s e l e c t   a 1 . s t u d e n t 
 
 f r o m   s a l s a S t u d e n t s   a 1 ,   s a l s a S t u d e n t s   a 2 ,   s a l s a S t u d e n t s   a 3   
 
 w h e r e   a 1 . s t u d e n t   =   a 2 . s t u d e n t   a n d   a 2 . s t u d e n t   =   a 3 . s t u d e n t   a n d   
 
 ( a 1 . l e v e l   =   1 )   a n d   ( a 2 . l e v e l   =   2 )   a n d   ( a 3 . l e v e l   =   3 )   a n d 
 
 ( a 1 . t e a c h e r   < >   a 2 . t e a c h e r )   a n d   ( a 2 . t e a c h e r   < >   a 3 . t e a c h e r ) ; 
 
 
 
 
 
 D E S >   / *   S t u d e n t s   o f   b a s i c   l e v e l   w i t h   d i f f e r e n t   t e a c h e r s   a n d   n o   i n t e n s i v e   l e v e l   * / 
 
 
 
 
 
 D E S >   / *   T w o   e q u i v a l e n t   f o r m u l a t i o n s   b e l o w   ( t h e   f i r s t   o n e   i s   n o t   a c c e p t e d   b y   M y S Q L )   * / 
 
 
 
 
 
 D E S >   / * c r e a t e   o r   r e p l a c e   v i e w   c a n d i d a t e s ( s t u d e n t )   a s 
 
     s e l e c t   s t u d e n t 
 
     f r o m     b a s i c L e v e l S t u d e n t s 
 
 e x c e p t 
 
     s e l e c t   s t u d e n t 
 
     f r o m     i n t e n s i v e S t u d e n t s ; 
 
 * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   c a n d i d a t e s ( s t u d e n t )   a s 
 
     s e l e c t   s t u d e n t 
 
     f r o m     b a s i c L e v e l S t u d e n t s 
 
 w h e r e   s t u d e n t   n o t   i n   ( 
 
     s e l e c t   s t u d e n t 
 
     f r o m     i n t e n s i v e S t u d e n t s ) ; 
 
 
 
 
 
 D E S >   / *   C a n d i d a t e s   w i t h   n o   p a s t   d u e   p a y m e n t s   * / 
 
 
 
 
 
 D E S >   c r e a t e   o r   r e p l a c e   v i e w   a w a r d s ( s t u d e n t )   a s 
 
     s e l e c t   s t u d e n t 
 
     f r o m   c a n d i d a t e s   c 
 
     w h e r e     
 
             c . s t u d e n t   n o t   i n   ( s e l e c t   s t u d e n t 
 
                                         f r o m   p a y m e n t 
 
                                         w h e r e   s t a t e   =   ' u n p a i d ' ) 
 
             O R     / *   U N I O N   * / 
 
             c . s t u d e n t   i n   ( s e l e c t   s t u d e n t   f r o m   g r a n t s ) ; 
 
 
 
 
 
 D E S >   
 
 
 
 
 
 I n f o :   B a t c h   f i l e   p r o c e s s e d . 
 
 
 
 D E S >   / d e b u g _ s q l   a w a r d s                                         
 
 
 
 I n f o :   D e b u g g i n g   v i e w   ' a w a r d s ' . 
 
 {                                                                                       
 
     1   -   a w a r d s ( ' A n a ' ) , 
 
     2   -   a w a r d s ( ' M i c a ' ) 
 
 } 
 
 I n p u t :   I s   t h i s   t h e   e x p e c t e d   a n s w e r   f o r   v i e w   ' a w a r d s ' ?   ( y / n / m / m T / w / w N / a / h )   [ n ] :   w 1 
 
 I n f o :   D e b u g g i n g   v i e w   ' i n t e n s i v e S t u d e n t s ' .       
 
 {                                                                                       
 
     1   -   i n t e n s i v e S t u d e n t s ( ' J u a n ' ) 
 
 } 
 
 I n p u t :   I s   t h i s   t h e   e x p e c t e d   a n s w e r   f o r   v i e w   ' i n t e n s i v e S t u d e n t s ' ?   ( y / n / m / m T / w / w N / a / h )   [ y ] :   
 
 I n f o :   D e b u g g i n g   v i e w   ' c a n d i d a t e s ' .                     
 
 I n p u t :   S h o u l d   ' c a n d i d a t e s '   i n c l u d e   a   t u p l e   o f   t h e   f o r m   ' A n a ' ?   ( y / n / a )   [ y ] :   n 
 
 I n f o :   D e b u g g i n g   v i e w   ' b a s i c L e v e l S t u d e n t s ' .     
 
 I n p u t :   S h o u l d   ' b a s i c L e v e l S t u d e n t s '   i n c l u d e   a   t u p l e   o f   t h e   f o r m   ' A n a ' ?   ( y / n / a )   [ y ] :   n 
 
 I n f o :   D e b u g g i n g   v i e w   ' s a l s a S t u d e n t s ' .               
 
 I n p u t :   S h o u l d   ' s a l s a S t u d e n t s '   i n c l u d e   a   t u p l e   o f   t h e   f o r m   ' A n a , 1 , t e a c h 1 ' ?   ( y / n / a )   [ y ] :   
 
 I n f o :   D e b u g g i n g   v i e w   ' s a l s a S t u d e n t s ' .               
 
 I n p u t :   S h o u l d   ' s a l s a S t u d e n t s '   i n c l u d e   a   t u p l e   o f   t h e   f o r m   ' A n a , 2 , t e a c h 2 ' ?   ( y / n / a )   [ y ] :   
 
 I n f o :   D e b u g g i n g   v i e w   ' s a l s a S t u d e n t s ' .               
 
 I n p u t :   S h o u l d   ' s a l s a S t u d e n t s '   i n c l u d e   a   t u p l e   o f   t h e   f o r m   ' A n a , 3 , t e a c h 1 ' ?   ( y / n / a )   [ y ] :   
 
 I n f o :   B u g g y   v i e w   f o u n d :   b a s i c L e v e l S t u d e n t s 
 
 
 
 D E S >   
 
 